C# pdf 缩放纸型-iTextSharp - read an existing pdf, resize it and then draw it on a new one
2017-10-23 20:26
911 查看
iTextSharp - read an existing pdf, resize it and then draw it on a new one
PdfReader reader = new PdfReader("In.PDF");
Document doc = new Document(PageSize.A4, 0, 0, 0, 0);
PdfWriter writer = PdfWriter.GetInstance(doc,
new FileStream("Out.PDF",
FileMode.Create));
doc.Open();
PdfContentByte cb = writer.DirectContent;
PdfImportedPage page = writer.GetImportedPage(reader, 1); //page #1
float Scale = 0.67f;
cb.AddTemplate(page, Scale, 0, 0, Scale, 0, 0);
doc.Close();
PdfReader reader = new PdfReader("In.PDF");
Document doc = new Document(PageSize.A4, 0, 0, 0, 0);
PdfWriter writer = PdfWriter.GetInstance(doc,
new FileStream("Out.PDF",
FileMode.Create));
doc.Open();
PdfContentByte cb = writer.DirectContent;
PdfImportedPage page = writer.GetImportedPage(reader, 1); //page #1
float Scale = 0.67f;
cb.AddTemplate(page, Scale, 0, 0, Scale, 0, 0);
doc.Close();
相关文章推荐
- Create a New SharePoint Permission Level and Bind it to an Existing SharePoint Group
- Installation failed with message...It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
- Create a New SharePoint Permission Level and Bind it to an Existing SharePoint Group
- It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing ___Error Installing APK
- How to remove an ASM instance and its corresponding database(s) on WINDOWS
- Create a new repository on the command line/Push an existing repository from the command line
- If you modify the UNID of an existing document, it becomes a new document.
- How to remove an ASM instance and its corresponding database(s) on UNIX
- 【转】C# : Enum and overriding ToString on it
- Could not install the app on the device, read the error above for details. Make sure you have an And
- C# : Enum and overriding ToString on it
- How to create a project from existing source in Eclipse and then find it?
- Could not install the app on the device, read the error above for details. Make sure you have an And
- Call C# Code from C++ and read an array of struct which contains strings
- [Javascript] Different ways to create an new array/object based on existing array/object
- Alias "bootstrap.widgets.TbHeroUnit" is invalid. Make sure it points to an existing PHP file and the
- How To Add a New Disk(s) to An Existing Diskgroup on RAC (Best Practices).
- How to create a DLL library in C and then use it with C#
- discern the words in the picture and then search it on the web
- [20160731]read a file and print it on the screen