We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Orientation Issue in PDF file printing

Hi Aspose,

We try to print attached PDF file.Original file orientation is landscape but the printout result is in portrait.Below is the code we use for printing function.

Aspose.Pdf.Facades.PdfViewer pdfViewerKit = new Aspose.Pdf.Facades.PdfViewer();
pdfViewerKit.OpenPdfFile(filename);
System.Drawing.Printing.PrinterSettings printerSettings = getPrinterSettings(printerSetting, printerName, saveFolderName, outputFilename, false);


pdfViewerKit.AutoResize = true;
pdfViewerKit.PrintPageDialog = false;

pdfViewerKit.PrintDocumentWithSettings(printerSettings);
pdfViewerKit.ClosePdfFile();

We tried with different pdf library version.With version 6.2 ,print result is as same as the original file orientation.There is no issue.However with version 6.4 and 6.6 change original file orientation into portrait.

Apparently there is a bug in new released.


Change to another library namespace Aspose.Pdf.Kit.PdfViewer also give the same result…
We use Aspose.Pdf.Kit version 5.9 and 6.0

Aspose.Pdf.Kit.PdfViewer pdfViewerKit = new Aspose.Pdf.Kit.PdfViewer();

pdfViewerKit.OpenPdfFile(filename);
System.Drawing.Printing.PrinterSettings printerSettings = getPrinterSettings(printerSetting, printerName, saveFolderName, outputFilename, false);


pdfViewerKit.AutoResize = true;
pdfViewerKit.PrintPageDialog = false;

pdfViewerKit.PrintDocumentWithSettings(printerSettings);
pdfViewerKit.ClosePdfFile();


Please take it as priority and revert as soon as possible.


Regards
Amerischool

Hi aspose,

I forget to attach the file. THe file is attached.

Regards
Amerischool

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

Thank you for
sharing the sample code and template file.<o:p></o:p>

I am able to
generate your mentioned issue using your sample code and template file. Your
issue has been registered in our issue tracking system with issue id:
PDFNEWNET-33217. You will be notified via this
forum thread regarding any update against your issue.<o:p></o:p>

Sorry for the
inconvenience,<o:p></o:p>

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

As a work around, you may try PageSettings to get your desired results. Please see the following sample code and check if it fits your needs.

Aspose.Pdf.Facades.PdfViewer pdfViewerKit = new Aspose.Pdf.Facades.PdfViewer();

pdfViewerKit.OpenPdfFile("D:\\Pages+from+Life_After_Outlook_gmail.pdf");

System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();

printerSettings.PrinterName = "Adobe PDF";

System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();

//set PageSize (if required)

pgs.Landscape = true;

//set PageMargins (if required)

pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

pdfViewerKit.AutoResize = true;

pdfViewerKit.PrintPageDialog = false;

pdfViewerKit.PrintDocumentWithSettings(pgs,printerSettings);

pdfViewerKit.ClosePdfFile();

Sorry for the inconvenience,

Dear Nausherwan ,

Thanks for your work around solution.
However, we are not trying to change the original orientation.
We would like to get the result what we print.All along we do not face similar issue in pdf printing.
As i reported before ,we got issue just right after upgraded to Apeos.PDF 6.4 and same for 6.6.Working fine with 6.2. I am not too sure about 6.3 and 6.5 since never tested before.
We simply cannot downgraded to 6.2 for our customer also. Do not think it is right thing to do.It may fix this issue but cause another problem.
Obviously this is a bug and we understand that Aspose is working on it.
Can we get the estimated time line for that issue.As we also need to revert time line to our customer as well.

Thanks for your understanding
Regards
Amerischool

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

I have requested our development team to share the ETA regarding your issue. I will update you regarding the ETA once I get a response from the development team.

Sorry for the inconvenience,

Hi Nausherwan,

Thanks for your help.
We understand your development team is working on it.However we also need to full fill our customer requirement asap.Therefore, I am thinking alternative way.My thinking is to determine original file orientation/width programatically and set accordingly in pagesetting and print while aspose is working on issue. Could you please help me how can I determine original pdf file orientation or width and height.


Thanks
Regards
Amerischool

Hi Nausherwan,

Regarding with my previous post, I manage to get the original file orientation and set accordingly when printing.Now there is another issue.After pagesetting set to landscape, it print out as landscape layout. However the print out result is different from the original pdf file direct printing result. It shrinks and resize the page.Attach are the direct print out results and aspose printout result.
Please analyze and advise me which part is wrong.


Aspose.Pdf.Facades.PdfViewer pdfViewerKit = new Aspose.Pdf.Facades.PdfViewer();
pdfViewerKit.OpenPdfFile(filename);
System.Drawing.Printing.PrinterSettings printerSettings = getPrinterSettings(printerSetting, printerName, saveFolderName, outputFilename, true);

System.Drawing.Printing.PageSettings pageSetting = new System.Drawing.Printing.PageSettings();

Aspose.Pdf.Facades.PdfPageEditor pageEditor = new Aspose.Pdf.Facades.PdfPageEditor();
pageEditor.BindPdf(filename);

if (pageEditor.GetPageSize(1).IsLandscape)
{
pageSetting.Landscape = true;
}
else
{
pageSetting.Landscape = false;
}

pdfViewerKit.AutoResize = true;
pdfViewerKit.PrintPageDialog = false;
pdfViewerKit.PrintDocumentWithSettings(pageSetting, printerSettings);
pdfViewerKit.ClosePdfFile();

Thanks for your help
Regards
Amerschool


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

Thank you for being patient.

I have received a feedback from the development team regarding your issue. Your reported issue is scheduled to be fixed and will be a part of our next official release of Aspose.Pdf for .NET v6.8 (to be released in early March 2012). You will be notified via this forum thread once the new release is available for download. As a work around, you may try the following code and see if it works fine in your scenario.

Aspose.Pdf.Facades.PdfViewer pdfViewerKit = new Aspose.Pdf.Facades.PdfViewer();

pdfViewerKit.OpenPdfFile("Pages+from+Life_After_Outlook_gmail.pdf");

System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();

printerSettings.PrinterName = "Adobe PDF";

pdfViewerKit.AutoResize = true;

pdfViewerKit.AutoRotate = true;

pdfViewerKit.PrintDocumentWithSettings(printerSettings);

pdfViewerKit.ClosePdfFile();

Sorry for the inconvenience,

Hi Nausherwan,

Thanks for your reply and code. It solves the orientation problem. However the alignment of the print result file is not right.There are more space in left than right side. Please take a look on attachment aspose.png file which is i scanned from print out result file. You can compare with direct print result file.Is there anyway to adjust the alignment.If there is no solution for adjustment issue for the moment , I wish it will solved in new released Aspose.Pdf 6.8.

Thanks for your ETA .I have a few feedback regarding with aspose.facades.

Please

Hi Nausherwan,

Regarding with Aspose.facade feeback please see the thread below.

http://www.aspose.com/community/forums/361395/aspose.pdf.facades-vs-aspose.pdf.kit/showthread.aspx#361395

Thank you so much for your help and support
Regards
Amerischool

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

I have replied to your reported issue regarding Aspose.Pdf.Facades in the respective thread.

Thank You & Best Regards,

Hi Nausherwan,

Could you replicate the alignment problem?
Orientation Issue in PDF file printing




Regards
Amerischool

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

I have replied to your reported issue regarding Aspose.Pdf.Facades in the respective thread.

Sorry for the inconvenience,

Thanks for your patience. Please note that the issues you have found earlier (filed as PDFNEWNET-33217) have been fixed in this update.


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