Add watermark to PDF using PDFium - pdf

I'm implementing a PDF editor on UWP using PDFium as the base library. I cannot seem to find any proper way of adding/creating watermarks on a document.
I went through the PDFium source and spec documents but didn't find anything useful.
I tried to analyze some PDF documents with watermarks but it is unclear how they are created and couldn't find a common mapping too.
Could someone please help me understand how watermarks are added to PDF documents?
Any help is much appreciated. Thanks

Related

Does anyone know of a technology that allows one to edit the tags on pdfs?

I am looking to programmatically edit the tags in a pdf document.In particular I would like to be able to copy tags from one document to another, and edit them as I copy them over.
I have looked at coherent pdf, pythons pdfrw and pythons pdfedit and not been sucessful. I am creating the pdfs in Latex so any Latex based solution would be amazing, but i have not come up with anything that allows me to create tags).
Any advise?

Convert Pdf to Bitmap via code

I know there's tons of threads about this "out there" but all I can find is bitmap to pdf and how do add images to a PDF.
I have a PDF which I would like to convert to JPEG. I've tried to use the iTextSharp but I can only find info about making a pdf, not the other way araound. Any ideas or links to actual code?
ImageMagick uses Ghostscript to handle PDFs so if this is your only task I'd recommend just using Ghostscript. There's a managed wrapper here and you can get the Ghostscript binaries from here. They come in an installer but you can just extract them using 7-Zip. See this discussion on what you need to deploy in your app. You might have to play around with 32-bit vs 64-bit. Also, on the Ghostscript download page please read the "Which license is right for me?" section.

Save out a new PDF with updates from users

In my iOS app, I would like to regenerate an existing pdf into another pdf after the users are done annotating on the existing pdf.
My regenerated pdf should be an exact replica of the existing pdf but should have embedded annotations and highlights etc which can be opened and viewed on desktops as well.
I have done some research on this including the solutions proposed on other SO posts. I have tried libharu etc.
But somehow I am not able to convert an existing pdf into a replica pdf. I am able to add annotations to a new pdf I create using libharu.
Now my problem is to copy the existing pdf as is to my regenerated pdf. Any pointers will be much helpful.
My understanding is that a library that can save back out a PDF with "true" annotations (those that can be hidden in Acrobat, for example) is not something that exists in a FOSS solution.
LibHaru, for example, only supports creating new PDFs, not editing or appending existing PDFs. From their homepage:
At this moment libHaru does not support reading and editing existing
PDF files and it's unlikely this support will ever appear.
You can render the PDF on a page by page basis, and then re-save it with some additional information. This S.O question has a reasonable looking piece of code. That will save any "annotations" more as an image in the PDF itself, though.
You might try a paid library like PDFNet.

Adding a PDF field in Landscape document in c#

I am using PDF Clown for this purpose.
I wanted to add fields in PDF document. Actually I have successfully added fields in portrait PDF documents but doing the same in Landscape PDF documents is troubling.
Controls are placed vertically instead of horizontally.
Please help in this matter even if your proposed solution is using any other library. I will be very thankful.
Regards,
Mujtaba Panjwani
PS. I have tried PDFSharp.NET but that seems to have no support for creating fields and for iTextsharp, I am not sure.
iTextSharp should do the trick. Have a look at the many examples available on their website.

PDF Creator - Difference in the PDF Quality vs Adobe Acrobat. How can I change it?

When I am using PDF Creator to create PDF documents the quality of the fonts is not exactly the same as when I am using Adobe Acrobat to create the same PDF. The fonts when creating with pdf creator are a bit more fussy (not as crispy as with Adobe).
Does anyone know if/how I can resolve this?
Here are 2 example documents that demonstrate what I mean:
Example of PDF created with PDF Creator
Example of PDF created with Adobe Acrobat
I don't have a solution for you unfortunately but I can tell you that what you are seeing is anti-aliasing. If anti-aliasing is enabled, fonts at lower resolutions will get that "fuzziness" that some people believe helps with reading. It might not look as pretty but it improves word recognition (so the theory goes). But that's beside the point. What you need to do is look for a setting to disable anti-aliasing. If you can't find it then you might have to look into setting actual Ghostscript settings, possibly dTextAlphaBits but I'm not a Ghostscript expert.
You can tell its anti-aliasing because the "fuzziness" only appears when the fonts are small. Once you zoom in it all goes away.
Image zoomed out:
Image zoomed in