Generated PDF using .NET cannot print by Adobe Reader

Hi guys,

When generating a PDF using Aspose.Pdf (to convert a Word document), the PDF cannot be printed if the document contains a hyperlink.

The PDF files open up fine in Adobe Reader, but when trying to print them we get this error message:
"The document could not be printed."
Followed by this error message when clicking “OK”…
"There were no pages selected to print."

We are using the latest version of Aspose.Pdf, and an older version of Aspose.Words. We have tested printing the document on various versions of Adobe Reader, but the error is quite common.

I have attached a sample file. It’s a plain Word document with a hyperlink on it, converted to PDF via Aspose.Pdf. This file does not print for me or my clients.

Below is the VB code we are using to generate the file:

’… Imports Aspose.Words

Document myNote = New Document(filePath) 'Open template file
myNote.Save(finalPath) 'Save template to a new path
myNote.Save(xmlFile, SaveFormat.AsposePdf) 'Save template as XML file to be edited in PDF

’Save as PDF using the XML
Dim pdf As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf
pdf.BindXML(xmlFile, Nothing)
pdf.IsImagesInXmlDeleteNeeded = True
pdf.IsTruetypeFontMapCached = True
pdf.TruetypeFontMapPath = binPath
pdf.Save(pdfPath)

Hi David,

Thanks for your query. It seems that your query is more related to Aspose.PDF. It would be great, If you share some detail about your issue related to Aspose.Words and Aspose.PDF separately.

I have converted a sample word document created by MS word which has hyperlink to PDF by using Aspose.Words. I have successfully printed the generated PDF file. Please find that PDF (Document.Doc2PdfSave Out.pdf) file in attachment.

Please see the following code snippet. The output pdf file can be printed successfully.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.Write("Please make sure to visit ");

// Specify font formatting for the hyperlink.

builder.Font.Color = Color.Blue;

builder.Font.Underline = Underline.Single;

// Insert the link.

builder.InsertHyperlink("Aspose Website", "http://www.aspose.com", false);

// Revert to default formatting.

builder.Font.ClearFormatting();

builder.Write(" for more information.");

doc.Save(MyDir + "DocumentBuilder.InsertHyperlink Out.pdf");

Please read following documentation links for your kind reference.

Inserting a Hyperlink
Saving a Document

Hi there,


Thanks for your inquiry.

It sounds like you are using a very old version of Aspose.Words which rendered documents to PDF by using Aspose.Pdf as well. Now in more recent versions, Aspose.Words includes it’s own renderer.

If you are having troubles converting that document using the old versions then it must be a bug. Since no fixes are made to older versions, I’m afraid then the only option would be to upgrade to the latest version.

If we can help with anything else, please feel free to ask.

Thanks,