Monday, 15 August 2011

c# - Jpeg to pdf with itextsharp is cutted on top and bottom -



c# - Jpeg to pdf with itextsharp is cutted on top and bottom -

i utilize itextsharp assembly in order convert jpg pdf.

my jpg scanned twain ( a4). jpg good.

i convert png in pdf this:

document doc = new document(); pdfwriter.getinstance(doc, new system.io.filestream(this._filename, system.io.filemode.create)); doc.open(); itextsharp.text.image img = itextsharp.text.image.getinstance(scanners.twain.getimage(i), system.drawing.imaging.imageformat.jpeg); doc.setpagesize(new itextsharp.text.rectangle(0, 0, img.width, img.height)); doc.newpage(); doc.add(img); doc.close();

my problem thaht pdf resulted bit ( bit) cutted on top , on bottom. why ?

how can avoid ?

thanks lot,

seuxin

unless specify otherwise, document has margin of 36 on sides. can remove them by:

doc.setmargins(0, 0, 0, 0);

c# .net pdf itextsharp twain

No comments:

Post a Comment