IPXC_Page.DrawToDevice missing Annotations

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
mmasood
User
Posts: 101
Joined: Fri Sep 18, 2015 9:49 pm

IPXC_Page.DrawToDevice missing Annotations

Post by mmasood »

Hi Alex,

I am using DrawToDevice method to print a pdf page to the printer. Following is a part of my code:

Code: Select all

    Dim oPage As IPXC_Page
    Set oPage = pDoc.Pages.Item(l_currentPage)
    
    Dim oParams As IPXC_PageRenderParams
    Set oParams = oTrackerInstance.CreateRenderParams
    oParams.PageViewBox = PBox_PrintBox
    oParams.RenderFlags = RF_DisplayLargeImages & RF_SmoothImages
    oParams.TextSmoothMode = TSM_ClearType
    
    Dim oContext As IPXC_OCContext
    Set oContext = oTrackerInstance.CreateStdOCCtx
    oContext.RenderType = RenderType_ModePrint
    oContext.Resolution = 600 
    oContext.PrintContentFlags = CF_SETACTIVATEDEFAULT
    oContext.ZoomLevel = 100
    
    ' set the top and left of the renderRect '
    renderRect.Top = 0
    renderRect.Left = 0
    setDevrect l_currentPage
    ' center the page '
    setCentering
    
    Dim oMatrix As PXC_Matrix
    If Abs(oPage.Rotation) = 90 Or Abs(oPage.Rotation) = 270 Then
        oMatrix.a = 0
        oMatrix.b = dDrawScale
        oMatrix.c = dDrawScale
        oMatrix.d = 0
        oMatrix.e = renderRect.Left
        oMatrix.f = renderRect.Top
    Else
        oMatrix.a = dDrawScale
        oMatrix.b = 0
        oMatrix.c = 0
        oMatrix.d = dDrawScale
        oMatrix.e = renderRect.Left
        oMatrix.f = renderRect.Top
    End If
    
    oPage.DrawToDevice clP.hdc, renderRect, oMatrix, DDF_AsVector, oParams, oContext
    
    Set oContext = Nothing
    Set oParams = Nothing
    Set oPage = Nothing
This works perfectly fine for most documents. However if there are annotations in the file, the results vary. "Stamp" annotations are printed out perfectly fine while none of following that I encountered appear on the printed page:

1. Free Text
2. Square
3. Popup

Is there a step that I am missing in the code above?

Regards,
M
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Page.DrawToDevice missing Annotations

Post by Sasha - Tracker Dev Team »

Hello mmasood,

You can try specifying the IPXC_AnnotsVisibilityCallback with your custom implementation that will return GetAnnotVisibility as AVS_Visible for all of the annotations. Try that and see whether this works.
Alternatively you can try passing null as the IPXC_OCContext and see whether that will work.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
mmasood
User
Posts: 101
Joined: Fri Sep 18, 2015 9:49 pm

Re: IPXC_Page.DrawToDevice missing Annotations

Post by mmasood »

Hi Alex,

I tried with both approaches that you mentioned. These are the details:

1. Callback method:

Below is the code for the callback:

Code: Select all

Implements IPXC_AnnotsVisibilityCallback

Public Function IPXC_AnnotsVisibilityCallback_GetAnnotVisibility(ByVal pDoc As IPXC_Document, ByVal annot As IPXC_Annotation) As PXC_AnnotVisibility
    IPXC_AnnotsVisibilityCallback_GetAnnotVisibility = AVS_Visible
End Function
and this is how it integrates with oContext:

Code: Select all

oContext.AnnotVisibilityCallback = New CAnnotVisibilityCallback
the rest of the code is the same as earlier. This does not work at all. I get the same results as before, only Stamp annotations are visible but none of the others.

2. Not using Context:
I had mixed results with this. All annotations are displayed but the text color changes from Red to Black in the annotations.

What should I change in my code to make it work?

Regards,
M
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Page.DrawToDevice missing Annotations

Post by Sasha - Tracker Dev Team »

Hello mmasood,

The developer who can answer this one is on vacation right now - he will get back to this when he's available.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
mmasood
User
Posts: 101
Joined: Fri Sep 18, 2015 9:49 pm

Re: IPXC_Page.DrawToDevice missing Annotations

Post by mmasood »

Hi Alex,

Do you have any updates on this?

Regards,
M
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Page.DrawToDevice missing Annotations

Post by Sasha - Tracker Dev Team »

Hello mmasood,

I will check whether he's already available.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: IPXC_Page.DrawToDevice missing Annotations

Post by Vasyl-Tracker Dev Team »

Hi mmasood.

Sorry for delay with answer. The problem is in your code:

Code: Select all

oContext.PrintContentFlags = CF_SETACTIVATEDEFAULT
- here you specified wrong value. Instead of it - please use flags from corresponding enum PXC_PrintContentFlags:

Fro example, to print all comments:

Code: Select all

oContext.PrintContentFlags = PXC_PrintContentFlags.PrintContent_Page |
						PXC_PrintContentFlags.PrintContent_Markups |
						PXC_PrintContentFlags.PrintContent_Stamps |
						PXC_PrintContentFlags.PrintContent_Widgets |
						PXC_PrintContentFlags.PrintContent_Notes |
						PXC_PrintContentFlags.PrintContent_NotePopups |
						PXC_PrintContentFlags.PrintContent_Media
HTH
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
mmasood
User
Posts: 101
Joined: Fri Sep 18, 2015 9:49 pm

Re: IPXC_Page.DrawToDevice missing Annotations

Post by mmasood »

Hi Vasyl,

I tried the with the edit that you suggested and that has mixed results. I am able to get all the annotations printed on the page but the text within popup annotations is changes its color from Red to Black. Any ideas on why this is happening?

Regards,
M
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: IPXC_Page.DrawToDevice missing Annotations

Post by Vasyl-Tracker Dev Team »

Hi, M.
but the text within popup annotations is changes its color from Red to Black
- unfortunately but we were unable to reproduce such issue. May be it is document related issue, so, please provide the simple test-document for reproduce.

Also please be sure that you using latest version of our SDK..

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply