Developing a custom WPF PDF Viewer

Q:

We are looking for a pure WPF component which could be used in our application to achieve these requirements:

  1. Display a pdf file;

  2. Allow navigation, search, zoom in, zoom out, scroll;

  3. Change the palette of the displayed pdf file in runtime.

The palette represents the background, font color, image color etc. of the displayed pdf file.

I have downloaded the trial version of the component from your web site, but the functionalities for the 3rd requirement have not been found.

I appreciate a lot if you could tell me if the needed functionalities provided by PDFTron PDFNet WPF component?

A: 1 & 2 are available out of the box.

Regarding your 3rd requirements you could use the following methods to adjust the color of control and page background:

void SetBackgroundColor(SysMedia::Color c);

void SetDefaultPageColor(SysMedia::Color c);

There other methods that can be used to adjust the page layout:

void SetPageBorderVisibility(Boolean border_visible);

void SetPageTransparencyGrid(bool trans_grid_visible);

void SetHorizontalAlign(Int32 align);

void SetVerticalAlign(Int32 align);

void SetPageSpacing(Int32 horiz_col_space, Int32 vert_col_space, Int32 horiz_pad, Int32 vert_pad);

Regarding to be able to change ‘font & image color’ it is not exactly clear what is the requirement. In any case you should be able to use the approach from ElementEdit sample (http://www.pdftron.com/pdfnet/samplecode.html#ElementEdit) to modufy color and other properties on text, path, and image elements. In particular ElementEdit sample program strips all images from the page and changes text color to blue. This could be a pre-processing step before PDF is opened in the viewer.

All the samples/demos are included as part of the SDK.

Q: Thank you very much for your quick reply and the meaningful help. But as I tried to test the functionalities you mentioned in your email, I have found “PDFViewCtrl” is not a native wpf control.

A:

The control you want to use is ‘pdftron.PDF.PDFViewWPF’, not the ‘pdftron.PDF.PDFViewCtrl’.

The former is a true WPF control, the latter a Windows Forms control.

On Thursday, May 31, 2012 5:20:20 PM UTC-7, Support wrote:

Q:

We are looking for a pure WPF component which could be used in our application to achieve these requirements:

  1. Display a pdf file;

  2. Allow navigation, search, zoom in, zoom out, scroll;

  3. Change the palette of the displayed pdf file in runtime.

The palette represents the background, font color, image color etc. of the displayed pdf file.

I have downloaded the trial version of the component from your web site, but the functionalities for the 3rd requirement have not been found.

I appreciate a lot if you could tell me if the needed functionalities provided by PDFTron PDFNet WPF component?


A: 1 & 2 are available out of the box.

Regarding your 3rd requirements you could use the following methods to adjust the color of control and page background:

void SetBackgroundColor(SysMedia::Color c);

void SetDefaultPageColor(SysMedia::Color c);

There other methods that can be used to adjust the page layout:

void SetPageBorderVisibility(Boolean border_visible);

void SetPageTransparencyGrid(bool trans_grid_visible);

void SetHorizontalAlign(Int32 align);

void SetVerticalAlign(Int32 align);

void SetPageSpacing(Int32 horiz_col_space, Int32 vert_col_space, Int32 horiz_pad, Int32 vert_pad);

Regarding to be able to change ‘font & image color’ it is not exactly clear what is the requirement. In any case you should be able to use the approach from ElementEdit sample (http://www.pdftron.com/pdfnet/samplecode.html#ElementEdit) to modufy color and other properties on text, path, and image elements. In particular ElementEdit sample program strips all images from the page and changes text color to blue. This could be a pre-processing step before PDF is opened in the viewer.

All the samples/demos are included as part of the SDK.