Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, May 28, 2015 11:39:30 AM(UTC)

Irving  
Irving

Groups: Registered
Posts: 3


I have a PDF document created by a Fax service (rightfax?) The document pages are TIFF images - some are upside down or landscape oriented. I need to rotate them to fix the orientation for portrait viewing.

How do I do that? I have v18/v19 (and the PDF package)

Thanks!
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, May 29, 2015 7:17:53 AM(UTC)

NathanM  
Guest

Groups: Guests
Posts: 3,040

Was thanked: 1 time(s) in 1 post(s)

You can manually rotate them, where you would pass the angle using the RotateCommand:
https://www.leadtools.com/help/leadtools/v19/dh/l/leadtools~leadtools.imageprocessing.rotatecommand.html

However if you want it to auto-detect how it should be rotated, the only way we could do that is if it had a lot of text on it, you could use the auto-rotate functionality of the OCR.

There is an older post that discusses similar functionality:
http://support.leadtools.com/SupportPortal/CS/forums/24546/showpost.aspx
https://www.leadtools.com/help/leadtools/v19/dh/fo/leadtools.forms.ocr~leadtools.forms.ocr.ocrautopreprocesspagecommand.html

Without the OCR/Text there is no way for our SDK to determine what is the proper orientation, with text it has a reference point.

If you have any other questions, please let us know.
 
#3 Posted : Monday, August 17, 2015 4:05:54 PM(UTC)

Irving  
Irving

Groups: Registered
Posts: 3


Thanks. How do I replace the page/image that i rotated on the original PDF document? Below is a quick snippet.
My goal is to rotate the first page on a multi-page document and save it. Not sure how to save the rotated image back on the PDF.

void RotatePdfPage(string pdfFileName)
{
PDFFile file = new PDFFile(pdfFileName);
using (PDFDocument document = new PDFDocument(pdfFileName))
{
using (RasterCodecs codecs = new RasterCodecs())
{
int pageNumber = 1;
using (RasterImage image = document.GetPageImage(codecs, pageNumber))
{
CodecsRasterPdfInfo pdfInfo = codecs.GetRasterPdfInfo(pdfFileName, pageNumber);

RotateCommand command = new RotateCommand();
command.Angle = 90 * 100;
command.FillColor = new RasterColor(255, 255, 255);
command.Flags = RotateCommandFlags.Bicubic;
command.Run(image);

// TODO: Save the rotated page in the original PDF docuemnt
}
}
}
}
 
#4 Posted : Friday, August 21, 2015 11:18:04 AM(UTC)

NathanM  
Guest

Groups: Guests
Posts: 3,040

Was thanked: 1 time(s) in 1 post(s)

The problem is you can't save over it unless it was a RasterPDF created with leadtools. See:
http://support.leadtools.com/SupportPortal/CS/forums/44337/ShowPost.aspx

You can however create a new pdf pretty simply with the rotated page.
codecs.Save(image, pdfFileName, RasterImageFormat.RasPdf, 0);

Then with that PDF you would be able to use the codecs overloads to add in pages/overwrite/replace.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.141 seconds.