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.
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?
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.
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
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.
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?
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..