Is it possible to print PDF directly from code without the use of the viewer?

Hi Veerle,

Have you tried AutoResize property of the PdfViewer class? Please test the issue by setting this property to true. Please also have a look at the PageSettings class members and see if that might be of some help.

If it doesn’t resolve your issue, then please share the sample PDF file along with the code snippet with us, so we could test the issue at our end.

We’re sorry for the inconvenience.
Regards,

Did you test the issue at your end?

regards,

Veerle

Hi,

We are unable to finish the project with our client due to the poor printing quality of the PDF's and the poor scaling of the PDF's.

I wish the error is an our side but we tried different settings with both available functions.

The API output of our print statements is completely unpredictable and somethime printing crashes.

I tried playing with the same code of my colleque Veerle but have the same pour results.

When printing the same document with Acrobat Reader the PDF document which is longer than an A4 is correctly sized to an A4.

With aspose we are unable to come to the same result.

Veerle sent you the original pdf file and code. We can't put the document in this forum as we may not publish our clients information to the whole internet community.


We are really stuck here. Can someone look into this as soon as possible?

Here is the code that I used during testing:

Private Sub PDFPrint(ByVal vsFinalDocument As String)

Dim loPdfPrinter As Aspose.Pdf.Kit.PdfViewer

Dim loPrinterSettings As New System.Drawing.Printing.PrinterSettings

Dim loPageSettings As New System.Drawing.Printing.PageSettings

Dim loPaperSize As System.Drawing.Printing.PaperSize

Dim loprinterresolution As New System.Drawing.Printing.PrinterResolution

Try

'loPrinterSettings.PrinterName = "Microsoft Office Document Image Writer"

'loPrinterSettings.PrinterName = "Adobe(PDF)"

loPrinterSettings.PrinterName = "\\Arcobe01\CanoniRC2880"

loPrinterSettings.PrintRange = Drawing.Printing.PrintRange.AllPages

'loprinterresolution.X = 600

'loprinterresolution.Y = 600

loPaperSize = New System.Drawing.Printing.PaperSize("A4", 827, 1169)

'loPageSettings.PrinterResolution = loprinterresolution

loPageSettings.PaperSize = loPaperSize

'loPageSettings.Margins.Left = 0

'loPageSettings.Margins.Top = 0

'loPageSettings.Margins.Right = 0

'loPageSettings.Margins.Bottom = 0

loPageSettings.Margins = New System.Drawing.Printing.Margins(0, 0, 0, 0)

loPdfPrinter = New Aspose.Pdf.Kit.PdfViewer()

loPdfPrinter.OpenPdfFile(vsFinalDocument)

loPdfPrinter.AutoResize = True

loPdfPrinter.AutoRotate = True

loPdfPrinter.Resolution = 300

loPdfPrinter.PrintPageDialog = False

'loPdfPrinter.PrintDocument()

loPdfPrinter.PrintDocumentWithSettings(loPageSettings, loPrinterSettings)

loPdfPrinter.ClosePdfFile()

loPdfPrinter.PrintLargePdf(vsFinalDocument, loPageSettings, loPrinterSettings)

Catch ex As Exception

End Try

End Sub

Hi,

We are unable to finish the project with our client due to the poor printing quality of the PDF's and the poor scaling of the PDF's.

I wish the error is an our side but we tried different settings with both available functions.

The API output of our print statements is completely unpredictable and somethime printing crashes.

I tried playing with the same code of my colleque Veerle but have the same pour results.

When printing the same document with Acrobat Reader the PDF document which is longer than an A4 is correctly sized to an A4.

With aspose we are unable to come to the same result.

Veerle sent you the original pdf file and code. We can't put the document in this forum as we may not publish our clients information to the whole internet community.


We are really stuck here. Can someone look into this as soon as possible?

Here is the code that I used during testing:

Private Sub PDFPrint(ByVal vsFinalDocument As String)

Dim loPdfPrinter As Aspose.Pdf.Kit.PdfViewer

Dim loPrinterSettings As New System.Drawing.Printing.PrinterSettings

Dim loPageSettings As New System.Drawing.Printing.PageSettings

Dim loPaperSize As System.Drawing.Printing.PaperSize

Dim loprinterresolution As New System.Drawing.Printing.PrinterResolution

Try

'loPrinterSettings.PrinterName = "Microsoft Office Document Image Writer"

'loPrinterSettings.PrinterName = "Adobe(PDF)"

loPrinterSettings.PrinterName = "\\Arcobe01\CanoniRC2880"

loPrinterSettings.PrintRange = Drawing.Printing.PrintRange.AllPages

'loprinterresolution.X = 600

'loprinterresolution.Y = 600

loPaperSize = New System.Drawing.Printing.PaperSize("A4", 827, 1169)

'loPageSettings.PrinterResolution = loprinterresolution

loPageSettings.PaperSize = loPaperSize

'loPageSettings.Margins.Left = 0

'loPageSettings.Margins.Top = 0

'loPageSettings.Margins.Right = 0

'loPageSettings.Margins.Bottom = 0

loPageSettings.Margins = New System.Drawing.Printing.Margins(0, 0, 0, 0)

loPdfPrinter = New Aspose.Pdf.Kit.PdfViewer()

loPdfPrinter.OpenPdfFile(vsFinalDocument)

loPdfPrinter.AutoResize = True

loPdfPrinter.AutoRotate = True

loPdfPrinter.Resolution = 300

loPdfPrinter.PrintPageDialog = False

'loPdfPrinter.PrintDocument()

loPdfPrinter.PrintDocumentWithSettings(loPageSettings, loPrinterSettings)

loPdfPrinter.ClosePdfFile()

loPdfPrinter.PrintLargePdf(vsFinalDocument, loPageSettings, loPrinterSettings)

Catch ex As Exception

End Try

End Sub

Hi there,

I'm having the very same issues and pretty much stuck. Previous versions of the PDF kit give me "corrupt or too many pages" error and newer version has scaling problems. Can't go forward and can't go backwards.

Aspose - any solution or hotfix?

Hi,

We’re looking into these issues and update you, the earliest possible.

We’re sorry for the inconvenience.
Regards,

Hi,

I have logged this issue as PDFKITNET-12382 in our issue tracking system. Our team will be looking into the matter and you’ll be updated via this forum once the issue is resolved.

We’re sorry for the inconvenience.
Regards,

Is the issue resolved? I have a new problem with the printing. I get an ‘out of memory’ exception (printlargepdf). We really need to find a solution for this problem.

Hi Veerle,

I’m sorry to inform you that the issue logged as PDFKITNET-12382 is not yet resolved. Our team is working on this issue and you’ll be updated once it is resolved.

Regarding ‘out of memory’ issue, please share the sample PDF file you’re having problem with. We need to test the issue at our end with your particular scenario. We’ll update you with the results accordingly.

We’re sorry for the inconvenience.
Regards,