How does itextshap insert images in PDF?

Source: Internet
Author: User

I recently wrote a PDF resolution library and an editing Library (C ++/C), and finally found that the image was inserted into the PDF, and the image displayed in the PDF was overwritten by the original content. You can use Adobe to create a file to check whether any exceptions have been found. Therefore, if you want to use itextsharp to insert an image for testing, you can find that most of the information written on the internet is inserting an image when generating a PDF file. Search for information: inserting an image into a known PDF file.CodeAs follows:

Pdfreader reader = new pdfreader ("C :\\ 8.pdf"); pdfstamper Stamper = new pdfstamper (reader, new filestream (" C: \ 18.pdf", filemode. create); image Mm = image. getinstance ("C :\\ 2.png"); mm. setabsoluteposition (0,100); mm. scaleabsolute (154,154); // mm. setdpi () contentbyte under = Stamper. getovercontent (1); under. addimage (mm); Stamper. close (); reader. close ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.