PDFViewer Print to the "Adobe PDF" printer

I want to programatically print a PDF file to the "Adobe PDF" printer... the Adobe-supplied printer driver that creates a PDF file (rather than output to the printer). In other words, creating (via print) a PDF file from a PDF file... this is to reduce the size of the original PDF, which has lots of form fields and javascript.

Dim viewer As PdfViewer = New PdfViewer()
viewer.OpenPdfFile(fn)
viewer.PrintPageDialog = False 'do not produce the page number dialog when printing
Dim ps As System.Drawing.Printing.PrinterSettings = _
New System.Drawing.Printing.PrinterSettings()
ps.PrinterName = "Adobe PDF"
viewer.PrintDocumentWithSettings(ps)
viewer.ClosePdfFile()

This code sequence fails silently at the "PrintDocumentsWithSettings()" line.

If I simply print to the default printer (ie. remove the ps.PrinterName line), it prints fine.

Hi Gregg,

I have tested this code snippet at my end and it worked perfectly fine. Could you please make sure that the Adobe PDF printer is working fine at your end? You may try this by printing the PDF using Adobe Reader. Also, please download the latest version of Aspose.Pdf.kit for .NET and try with that.

However, if you still find the same issue at your end then please share the input PDF file with us, so we could test the issue at our end. Also, please mention the .NET Framework version and the OS you’re using at your end.

We’re sorry for the inconvenience and looking forward to help you out.
Regards,

OK, I've upgraded to ASPOSE.PDF (from APOSE.PDF.KIT), and tried to Print to the 'Adobe PDF' printer.

Now, a PDF file is created, but when I try to open the created PDF with Acrobat, I get a message:

Acrobat could not open 'xxx.pdf' because itis either not a supported file type or because the file has been damaged.I have attached both the "source" PDF file, and the "generated/printed" PDF file.

Here's the code:

dim pdfViewer as new PDFViewer
pdfView.OperPdfFile("gss1Signature.pdf")
dim printerSettings as new System.Drawing.Printing.PrinterSettings
printerSettings.PrinterName = "Adobe PDF"

printerSettings.PrintFileName = "c:\temp\gssPrint.pdf"
printerSettings.PrintToFile = true
pdfView.PrintPageDialog = false

pdfVIew.PrintDocumentWithSettings(printerSettings)
pdfViewer.ClosePDFFile()

Hi Gregg,

I have reproduced this problem at my end and logged it as PDFNEWNET-29303 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.
Regards,

The issues you have found earlier (filed as 29303 ) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

I have upgraded to ASPOSE.PDF (rather than .KIT) v6.3, and am using the aspose.pdf.facades namespace - I am still unable to "print" to the Adobe PDF printer, using the code above. In fact, now I am unable to print even to my laser printer, nor to the MICRSOFT XPS DOCUMENT WRITER.

I have tried w/ several different input PDF files, and with several different printers.

The symptom is still that the code "hangs" at teh PringDocumentWithSettings() line.

I am running Win7, 64 bit.

Hi Gregg,

We’re investigating this issue at our end. You’ll be updated with the results shortly.

We’re sorry for the inconvenience.
Regards,