Free Support Forum - aspose.com

Again the error message when printing pdf- from another block of code

Hi, All,

I don't if other got this error. Once I use Aspose.Pdf to create a Pdf, I got this error if send to a printer.

I did a tittle change on the sample code from Aspose documnent site

[VB.NET]

'open document

Dim pdfDocument As New Document("input.pdf")

'create page number stamp

Dim pageNumberStamp As New PageNumberStamp()

'whether the stamp is background

pageNumberStamp.Background = False

pageNumberStamp.Format = "Page # of " & pdfDocument.Pages.Count

pageNumberStamp.BottomMargin = 10

pageNumberStamp.HorizontalAlignment = HorizontalAlignment.Center

pageNumberStamp.StartingNumber = 1

for i as integer = 1 to pdfDocument.Pages.Count Step 1

pdfDocument.Pages(i).AddStamp(pageNumberStamp)

next

'save output document

pdfDocument.Save("output.pdf")

The page numner is created in output.pdf, which is what I expected.

But when output.pdf is sent to printer, the error from abrobat reader says:

"An error exists on the page. Abrobat may not displat this page correctly. Please contact the person who created the PDF document to correct the problem."

sxia

Hello Samuel,

Thanks for using our products.

Can you please share the source PDF document so that we can test the scenario at our end. We apologize for your inconvenience.

Here the pdf files attached. myPDFSend.pdf was created from myPDF.pdf by the following code

Dim contentEditor As New Aspose.Pdf.Facades.PdfContentEditor()

'bind input PDF file
contentEditor.BindPdf("O:\AppDev\sxia\Projects\LAR_PDF\WebAppProj\WebAppProj\PDF_Send\myPDF.pdf")


'make sure the regular expression strategy is being used
contentEditor.ReplaceTextStrategy.IsRegularExpressionUsed = True


contentEditor.ReplaceTextStrategy.ReplaceScope = Aspose.Pdf.Facades.ReplaceTextStrategy.Scope.REPLACE_ALL
'contentEditor.ReplaceTextStrategy.ReplaceScope = Aspose.Pdf.Kit.ReplaceTextStrategy.Scope.REPLACE_ALL


contentEditor.ReplaceText("Page [0-9]+ of [0-9]+", String.Empty)

'save output PDF file
contentEditor.Save("O:\AppDev\sxia\Projects\LAR_PDF\WebAppProj\WebAppProj\PDF_Send\myPDFSend.pdf")

Thanks

sxia

This is scenario for Add

The input pdf is myPDF.pdf; output, myPDFSendNumbered.pdf. Sending output pdf to printer with pages setting as "7,17,27,28", I got error message.

The code is:

Dim pdfDocument As New Aspose.Pdf.Document("O:\AppDev\sxia\Projects\LAR_PDF\WebAppProj\WebAppProj\PDF_Send\myPDF.pdf")


'create page number stamp
Dim pageNumberStamp As New PageNumberStamp()

'whether the stamp is background
pageNumberStamp.Background = False
pageNumberStamp.Format = "Page # of " & pdfDocument.Pages.Count
pageNumberStamp.BottomMargin = 10
pageNumberStamp.HorizontalAlignment = HorizontalAlignment.Center
pageNumberStamp.StartingNumber = 1


pageNumberStamp.TextState.FontSize = 9.0F


For i As Integer = 1 To pdfDocument.Pages.Count Step 1
'pageNumberStamp.Format = "Page " & i & " of " & pdfDocument.Pages.Count
pdfDocument.Pages(i).AddStamp(pageNumberStamp)
Next

'save output document
pdfDocument.Save("O:\AppDev\sxia\Projects\LAR_PDF\WebAppProj\WebAppProj\PDF_Send\myPDFSendNumbered.pdf")

Attaching myPDFSendNumbered.pdf for my last post

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template and resultant file.

We have found your mentioned issues regarding printing of Pdf file after an initial test. We have registered the issue in our issue tracking system with issue id: PDFNEWNET-29905. We will further look into it and get back to you.

Thank You & Best Regards,

Hi,

Any update on PDFNEWNET-29905?

Thanks.

sxia

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Sorry for the delayed response. Actually, our development team is still looking into this issue and it seems that this issue is only occurring on some specific adobe acrobat version and is not regenerating on all the versions. We will update you as soon as we have any update regarding this issue.

Sorry for the delay and inconvenience caused,

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


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