Rotating PDF 90 degrees using iTextSharp in C# -


i trying use pdf stamping , need rotate 90 degrees lay on correctly? know how this? can't seem find online.

the rotate90degrees example uses pdfreader instance of document changes /rotate value in every page dictionary. if there no such entry, /rotate entry value 90 added:

final pdfreader reader = new pdfreader(source); final int pagescount = reader.getnumberofpages();  (int n = 1; n <= pagescount; n++) {     final pdfdictionary page = reader.getpagen(n);     final pdfnumber rotate = page.getasnumber(pdfname.rotate);     final int rotation =             rotate == null ? 90 : (rotate.intvalue() + 90) % 360;      page.put(pdfname.rotate, new pdfnumber(rotation)); } 

once done, use pdfstamper persist change:

pdfstamper stamper = new pdfstamper(reader, new fileoutputstream(dest)); stamper.close(); reader.close(); 

this itext java. itextsharp, porting java c# easy terminology identical. change lower cases upper cases this:

pdfdictionary page = reader.getpagen(1); page.put(pdfname.rotate, new pdfnumber(90)); 

there's more or less identical code snippet in question part of post: how rotate pdf page itextsharp without causing error in ghostscript?


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

How do you convert a timestamp into a datetime in python with the correct timezone? -