Free Support Forum - aspose.com

Printing from PDFViewer brings corrupt File or empty Page


#1

Hello,

we´ve got an issue with printing a specific PDF File on the Microsoft XPS Document Writer, it creates a corrupt file. On a regular printer I get only an blank page.

Here is the file: testPDF.pdf (1.1 MB)

I am using the following code:

public override void Print(PrinterSettings printerSettings, PageSettings pageSettings)
{
using (new Document(“FileName”))
{
using (PdfViewer viewer = new PdfViewer(document))
{
try
{
viewer.PrintPageDialog = false;
if (printerSettings == null)
printerSettings = viewer.GetDefaultPrinterSettings();

                    if (pageSettings == null)
                        pageSettings = viewer.GetDefaultPageSettings();

                    viewer.PrintDocument(pageSettings, printerSettings);
                }
                catch (Exception ex)
                { throw ExceptionBuilder.NewException(ex); }
                finally
                {
                    viewer.Close();
                }
            }
        } 

Best regards


#2

@SBWDeveloper

Thank you for contacting support.

Would you please also share the code snippet specifying PrinterSettings and PageSettings including Print method call. Please also share generated files as a single zipped file for our reference. Before sharing requested data, kindly ensure using Aspose.PDF for .NET 18.11 in your environment.


#3

Hello Farhan,

i attached a corrupt XPS File, created from the already attached PDF File by using the Print Function of the Viewer and with the “Microsoft XPS Document Writer” as Default Printer. I also changed the Code snippet a bit, because the specification of PrinterSettings and PageSettings from outside the method does not matter:

public override void Print()
        {
            using (Document document = new Document(Filename))
            {
                using (PdfViewer viewer = new PdfViewer(document))
                {
                    try
                    {
                        viewer.AutoResize = true;
                        viewer.PrintPageDialog = false;
                        PrinterSettings printerSettings = viewer.GetDefaultPrinterSettings();
                        PageSettings pageSettings = viewer.GetDefaultPageSettings();
                        viewer.PrintDocument(pageSettings, printerSettings);
                    }
                    catch (Exception ex)
                    { throw ExceptionBuilder.NewException(ex); }
                    finally
                    {
                        viewer.Close();
                    }
                }
            }

Here is a zip file containing the PDF source File and the corrupted XPs File generated through the Print Method of the Viewer. files.zip (1.0 MB)


#4

@SBWDeveloper

We have been able to reproduce zero KB .oxps file in our environment. A ticket with ID PDFNET-45776 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.


#5

Hi there, is there anything new about the ticket? We have a customer, using our software who can´t use his pdf as long as we have that issue…

Thanks in advance


#6

@SBWDeveloper

Thank you for getting back to us.

We are afraid PDFNET-45776 is still pending for investigations owing to previously logged and critical tickets. It will be scheduled on its due turn which may take few more months. We appreciate your patience and comprehension in this regard.

However, we also offer Paid Support, where issues are used to be investigated with higher priority. Our customers, who have paid support subscription, report their issue there which are meant to be investigated urgently. In case your reported issue is a blocker, you may please consider subscribing for Paid Support. For further information, please visit Paid Support FAQs.


#7

Hello,

since I Need this fix and I don´t have a satisfying answer yet, will I get a delivery date for the fix, when I buy Paid support and push this ticket and will this issue be handled with proper speed then?

Best regards

Stefan


#8

@SBWDeveloper

Thank you for getting back to us.

Please note that Paid Support tickets always have higher priority and are resolved sooner as compared to Free Support tickets. However, we have recorded your request and will share the ETA with Paid Support subscription once initial investigations are completed.


#9

Hi,

the paid support ticket is #173463.

Thanks

Stefan


#10

@SBWDeveloper

Thank you for the information.

We have escalated the priority of PDFNET-45776 and will let you know as soon as significant updates will be available. Kindly follow up here.