I had originally posted this question over on stack overflow, but I was recommended to post here instead.

Original Question

I am in the process of converting a Windows Mobile application to Xamarin Forms, specifically Android. In the Windows Mobile app, we create PDFs using PDF4NET and are able to add Keywords to the Document Information section of the PDF. In the convert to Xamarin Forms (android), I am unable to continue using PDF4NET due to platform restrictions but I did come across PrintedPDFDocument. It fits all the requirements so far except for adding Keywords to the Document Information. The whole creation process of the PDF is done on the mobile device - text/images and metadata.

I haven't been able to find anywhere in the documentation for PrintedPDFDocument yet about adding keywords and it doesn't look like the object has a property for document information. Is there a special way to do this, or is it not supported at all? If there isn't a way to do Document Information in PrintedPDFDocument, what are some other options I have for PDF generation with Xamarin and Android?

This would be for commercial use, but if there is an open source library that handles this, that would be great.

Thanks in advance!

  • You mention PDF creation. What is the source of the PDF? From another file type (e.g. DOCX, PNG), or manually using PDF4NET API?
    – Ryan
    Commented Jul 3, 2018 at 21:03
  • @Ryan We are manually creating PDFs with PDF4NET and need to continue doing the same thing. Commented Jul 3, 2018 at 21:05
  • Oh, because your question said "I am unable to continue using PDF4NET". Are you saying you create the PDF server side using PDF4NET, but that you will add the Keyword Metadata on Android? Perhaps you could update your question to make things clearer.
    – Ryan
    Commented Jul 4, 2018 at 5:05
  • Thanks for the input; I went ahead and clarified that. We do the whole creation of the PDF on the mobile unit as the device may not always have connection to the internet. The creation of the PDF also needs to happen fairly often throughout the day as it is used as a "proof of delivery". As of right now, it looks like we are planning on using XFINIUM as that fits all of our needs. Commented Jul 4, 2018 at 19:49
  • So you will be porting the PDF4NET API code you used to generate the PDF to the XFINIUM API? Also, what importance are the Keywords to you? Its a rarely used feature, and is even deprecated in the latest PDF 2.0 ISO spec. Finally, could you elaborate on what you mean by "proof of delivery".
    – Ryan
    Commented Jul 4, 2018 at 22:36

3 Answers 3


The XFINIUM.PDF library supports adding keywords and other information to PDF files on Xamarin Android and iOS.
Code below shows how to accomplish this:

PdfFixedDocument document = new PdfFixedDocument(inputPdfFile);

// Display the document in full screen mode.
document.DisplayMode = PdfDisplayMode.FullScreen;

// Fill the document information.
document.DocumentInformation = new PdfDocumentInformation();
document.DocumentInformation.Author = "Xfinium Software";
document.DocumentInformation.CreationDate = DateTime.Now;
document.DocumentInformation.ModifyDate = DateTime.Now;
document.DocumentInformation.Creator = "Xfinium.Pdf DocumentProperties sample";
document.DocumentInformation.Producer = "Xfinium.Pdf";
document.DocumentInformation.Title = "Xfinium.Pdf DocumentProperties sample";
document.DocumentInformation.Subject = "Xfinium.Pdf sample code";
document.DocumentInformation.Keywords = "xfinium.pdf,pdf,sample";

// Set custom metadata in the XMP metadata.
document.XmpMetadata = new PdfXmpMetadata();
// This custom metadata will appear as a child of 'xmpmeta' root node.
document.XmpMetadata.Metadata = "<custom>Custom metadata</custom>";

// Set the viewer preferences.
document.ViewerPreferences = new PdfViewerPreferences();
document.ViewerPreferences.CenterWindow = true;
document.ViewerPreferences.DisplayDocumentTitle = true;
document.ViewerPreferences.HideMenubar = true;
document.ViewerPreferences.HideToolbar = true;
document.ViewerPreferences.HideWindowUI = true;
document.ViewerPreferences.PrintScaling = PdfPrintScaling.None;

// Set the PDF version.
document.PdfVersion = PdfVersion.Version15;


Disclaimer: I work for the company that develops the library.

  • Thank you for this. I've passed this information along and my company will be in touch with Xfinium with a question about Mobile vs Cross Platform versions. Commented Jul 3, 2018 at 16:15

Syncfusion Essential PDF supports for creating the PDF in the Xamarin application. Your requirement could be achieved by using the below code snippet

//Create a new PDF document.

PdfDocument document = new PdfDocument();

//Set document information.

document.DocumentInformation.Author = "Syncfusion";

document.DocumentInformation.CreationDate = DateTime.Now;

document.DocumentInformation.Creator = "Essential PDF";

document.DocumentInformation.Keywords = "PDF";

document.DocumentInformation.Subject = "Document information DEMO";

document.DocumentInformation.Title = "Essential PDF Sample";

//Add a page to the document.

PdfPage page = document.Pages.Add();

//Create PDF graphics for the page.

PdfGraphics graphics = page.Graphics;

//Set the font.

PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);

//Draw the text.

graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));

//Save the document.


//Close the document.



The custom schema can be created by using the below link https://help.syncfusion.com/file-formats/pdf/working-with-metadata#adding-custom-schema-to-the-pdf-document

The whole suite of controls is available for free (commercial applications also) through the community license program if you qualify (less than 1 million US Dollars in revenue). The community license is the full product with no limitations or watermarks.
Note: I work for Syncfusion.

  • Thank you for this recommendation. I'll pass this recommendation on before my boss commits to XFINIUM. Commented Jul 5, 2018 at 12:40

PDFTron PDFNet SDK supports full PDF creation and editing, along with a full fledged cross-platform rendering engine. The SDK, with identical API for PDF and Metadata creation, is available for Xamarin, Android, UWP, iOS, and Web, along with Linux, Windows (.Net, .NetCore) and macOS.

Our showcase app, Xodo, which is available for free in all mobile stores, and which has a 4.7/5 rating on Android, is a great way to evaluate our viewer. https://play.google.com/store/apps/details?id=com.xodo.pdf.reader

So with a single SDK and API, using Xamarin, you can support UWP, Android and if you like iOS.

To get started with your evaluation start here. https://www.pdftron.com/documentation/xamarin/guides

The SDK includes a CompleteReader sample, which is what the Xodo app is based off of.

Here is the sample for the low level page content API, though there are other ways to generate PDF page content with PDFNet. https://www.pdftron.com/documentation/samples/xamarin/cs/ElementBuilderTest?platforms=xamarin

To add keywords you would do something similar to the following. pdfdoc.GetDocInfo().SetKeywords("keyword1, keyword2, keyword3");

Finally, PDFTron offers full evaluation support, and can provide assistance with migrating from your PDF4NET code to PDFNet.

  • Thank you for this recommendation. I'll pass this recommendation on before my boss commits to XFINIUM. Commented Jul 4, 2018 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.