I have multiple logos of various companies in various formats that needs to be added to other PDFs. The format of these logos is not specified at the moment but it could be locked down to only certain formats if it causes issues.
These other PDFs will be mostly posters and will be printed off by the user.
Question: What is the best way for adding these logo's onto the PDF poster artwork on the fly to then be downloaded and printed by the user? Bareing in mind it needs to retain the original quality of the PDF when being printed.
Thanks in advance
See at my answer to a similar question. In short, I've used itextsharp to add watermark(s) to an existing PDF.
PDFSharp is a free library that can do this. These watermarking examples should help you get started.
Related
Does anyone know a way to render or export a pdf with either the text or the images stripped out?
I noticed a way that uses GhostScript:
https://stackoverflow.com/a/38010769/4437032
Unfortunately it would require me to get a commercial licence (since I intend to distribute).
The renderer I have been using up until now has been Pdfium, but that library has no capability to do this (without modifying the native code).
I also looked into PDFSharp, but it seems to be more for appending things to PDFs rather than removing things.
I cannot expect any kind of pdf editing software to be installed on machines that run my program, so ideally I'm looking for some free library.
Does anyone know of any solutions?
I ended up using the free version of Spire.Pdf to accomplish my goal, using it to create pdfs with either text or images. The free version limits you to a max of 10 pages in processed pdfs, but that is acceptable for me.
No images: delete all the images using Spire.Pdf
No text: extract all the images using Spire.Pdf, draw them onto a blank pdf.
then display the modified pdfs.
I am making an app in which I want to create pdfs out of the images I store in the Isolated storage. Many opensource libraries are available for solving the purpose but unfortunately none expresses their comparability with windows phone 8.
then I came across this link
the post explains about writing the pdf file by making the pdf header. But, this only creates a pdf with some text written in it. I, now want to add some images in it. How shall I proceed for the same?
I have found the answer myself. These are the links which would be very much helpful if you are looking to make a pff
with text and images without the usage of opensource libraries.
http://www.codeproject.com/Articles/18623/Add-Images-and-Textboxes-to-PDF
http://www.codeproject.com/Articles/7627/PDF-Library-for-creating-PDF-with-tables-and-text
http://en.wikipedia.org/wiki/Portable_Document_Format#Imaging%5Fmodel
Understanding the PDF file format – how are images stored
http://blog.idrsolutions.com/2010/04/understanding-the-pdf-file-format-how-are-images-stored/
Check the above links. They might be helpful.
I need to create a C# or C++ (MFC) application that converts pdf files to txt. I need not only to convert, but remove headers, footers, some garbage characters on the left margin etc. Thus the application shold allow the user to set page margins to cut off what is not needed. I actually have already created such an application using xpdf, but it gives me some problems when I am trying to insert custom tags into the extracted text to preserve italics and bold. Maybe somebody could suggest something useful?
Thanks.
There are shareware and freeware utilities out there. Try fetching their source code, or perhaps use them the way they are.
A public version of the PDF specification can be found here: Adobe PDF Specification
PDF Shareware readers can be found: PDF Reader source code # SourceForge
Please look at Podofo. It's a LGPL-licensed library that has many powerful editing features. One of it's examples, txt2pdf IIRC, is a good start: it shows basic text-extraction; From there you can check if pre (in pdf engine) or post (in text) filtering suffices to your goals. I didn't get to use Pdf Hummus, but it's supposed to have these capabilities too, although it's less straightforward.
So, I have used Pdf995's PDF print driver from a web browser to print web pages and eventually use PdfEdit995 to join these various PDF files into one large PDF.
Now I have a lot of large PDF documents that I wish to add bookmarks to, but am hoping there is a relatively easy way of doing this programmatically (using C#, preferably) - basically, I want to find, within each PDF, text that is large enough to qualify as a header, and use that text as the bookmark.
Any tips/advice/direction? Thanks!
It's definitely possible to do this, but I would recommend finding a PDF library that does most of the leg work. Technically you could do it all yourself with the aid of the PDF specification, but that'd probably take more time than it's worth.
The library will need to be able to let you find text in a document and then return the page and size, font, etc, of the text and create bookmarks (also known as outlines) based on that information programmatically.
My companies product, Quick PDF Library, can help you do this and so can PDFKit.NET. I'm sure there are other libraries out there that support this functionality too. As far as free libraries go, from what I've seen I don't believe that PDFSharp or iText will meet all of your requirements in this case, but I'm sure someone will correct me if I'm wrong.
If you'd prefer to develop a solution for this entirely yourself, then the PDF reference is available online for free.
I'm using itextsharp to generate the PDFs, but I need to change some text dynamically.
I know that it's possible to change if there's any AcroField, but my PDF doen's have any of it. It just has some pure texts and I need to change some of them.
Does anyone know how to do it?
Actually, I have a blog post on how to do it! But like IanGilham said, it depends on whether you have control over the original PDF. The basic idea is you setup a form on the page and replace the form fields with the text you want. (You can style the form so it doesn't look like a form)
If you don't have control over the PDF, let me know how to do it!
Here is a link to the full post:
Using a template to programmatically create PDFs with C# and iTextSharp
I haven't used itextsharp, but I have been using PDFNet SDK to explore the content of a large pile of PDFs for localisation over the last few weeks.
I would say that what you require is absolutely achievable, but how difficult it is will depend entirely on how much control you have over the quality of the files. In my case, the files can be constructed from any combination of images, text in any random order, tables, forms, paths, single pixel graphics and scanned pages, some of which are composed from hundreds of smaller images. Let's just say we're having fun with it.
In the PDFTron way of doing things, you would have to implement a viewer (sample available), and add some code over a text selection. Given the complexities of the format, it may be necessary to implement a simple editor in a secondary dialog with the ability to expand the selection to the next line (or whatever other fundamental object is used to make up text). The string could then be edited and applied by copying the entire page of the document into a new page, replacing the selected elements with your new string. You would probably have to do some mathematics to get this to work well though, as just about everything in PDF is located on the page by means of an affine transform.
Good luck. I'm sure there are people on here with some experience of itextsharp and PDF in general.
This question comes up from time to time on the mailing list. The same answer is given time and time again - NO. See this thread for the official answer from the person who created iText.
This question should be a FAQ on the itextsharp tag wiki.