Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found the solution, In order for the content to get displayed, an Appearance ("AP") Dictionary has to be set.</p> <p>This could be used for that:</p> <pre><code>void PdfField::CreateFieldAppearance(PdfMemDocument *memDoc, const PdfString &amp;value) { if( !m_pWidget-&gt;HasAppearanceStream() ) { PdfRect pageRect; PdfPainter painter; PoDoFo::PdfRect rect = this-&gt;GetWidgetAnnotation()-&gt;GetRect(); unsigned int width = rect.GetWidth(); unsigned int height = rect.GetHeight(); PdfRect pdfRect(0, 0, width, height); PdfXObject xObj(pdfRect, memDoc); painter.SetPage(&amp;xObj); painter.SetClipRect(pdfRect); painter.Save(); painter.SetColor(221.0/255.0, 228.0/255.0, 1.0); painter.FillRect(0, 0, width, height); painter.Restore(); // make rotation painter.Save(); /***********************************************************************************/ // Rotation Logic double angle = this-&gt;GetPage()-&gt;GetRotation(); if (angle) { double radAngle = angle * M_PI / 180; int cosA = (int)cos(radAngle); int sinA = (int)sin(radAngle); double translateY = rect.GetWidth(); // The View goes out of the bound, sits on top painter.SetTransformationMatrix(cosA, sinA, -sinA, cosA, translateY, 0); } /***********************************************************************************/ PdfFont *font = memDoc-&gt;CreateFont("Helvetica", true, false); font-&gt;SetFontSize(15); // Do the drawing painter.SetFont(font); painter.BeginText(10, 5); painter.SetStrokeWidth(20); painter.AddText(value); painter.EndText(); painter.FinishPage(); // This is very important. Not only does it disable the editing. // Also it does correct the appearance issue on Adobe Readers. this-&gt;SetReadOnly(true); // The Stream Object has to be saved to the annotation PoDoFo::PdfDictionary dict; dict.AddKey( "N", xObj.GetObject()-&gt;Reference() ); this-&gt;GetFieldObject()-&gt;GetDictionary().AddKey( "AP", dict ); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload