How can I append print named action in the post script file before ghostscript converts it into pdf ?
On Wed, Nov 15, 2017 at 8:18 PM, Amarjeet Singh <[email protected]> wrote: > Hi Team, > > > I want to automatically print the PDF by appending the following string > in the input_stream before *ghost script *command executes and generate > pdf in output_stream. > > String : - > > %AUTOPRINT[ /_objdef {PrintAction} /type /dict /OBJ pdfmark[ {PrintAction} << > /Type /Action /S /Named /N /Print >> /PUT pdfmark[ {Catalog} << /OpenAction > {PrintAction} >> /PUT pdfmark > > If I append it in file.ps and then run gs script then it works and file.pdf > automatically print the PDF but I cannot do that with guacamole as gs is > sending output as stream with "-sOutputFile=-" and > > taking input from input_stream. > > gs -q -dNOPAUSE -dBATCH -dSAFER -dPARANOIDSAFER -sDEVICE=pdfwrite > -sOutputFile=file.pdf -c .setpdfwrite -f file.ps > > Will it work if I append the above string in the buffer ? // > > void guac_rdpdr_process_print_job_write(guac_rdpdr_device* device, > wStream* input_stream, int completion_id) { > > guac_client* client = device->rdpdr->client; > guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; > guac_rdp_print_job* job = (guac_rdp_print_job*) rdp_client->active_job; > > unsigned char* buffer; > int length; > int status; > > /* Read buffer of print data */ > Stream_Read_UINT32(input_stream, length); > Stream_Seek(input_stream, 8); /* Offset */ > Stream_Seek(input_stream, 20); /* Padding */ > * buffer = Stream_Pointer(input_stream);* > > /* Write data only if job exists, translating status for RDP */ > if (job != NULL && (length = guac_rdp_print_job_write(job, > buffer, length)) >= 0) { > status = STATUS_SUCCESS; > } > > /* Report device offline if write fails */ > else { > status = STATUS_DEVICE_OFF_LINE; > length = 0; > } > > wStream* output_stream = guac_rdpdr_new_io_completion(device, > completion_id, status, 5); > > Stream_Write_UINT32(output_stream, length); > Stream_Write_UINT8(output_stream, 0); /* Padding */ > > svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream); > > } > > What are the options I have if I want to achieve the above ? Is there > anything else I can do to append it ? > > Thanks and Regards, > > Amarjeet Singh > >
