Print Page | Close Window

Render Checkbox Stream

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3781
Printed Date: 24 Apr 24 at 9:00AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Render Checkbox Stream
Posted By: Renaud
Subject: Render Checkbox Stream
Date Posted: 12 Feb 20 at 6:08AM
Hello Everyone, 

First of all, thank you for this forum, It helped me many times.

I'm using activex rev 1613 on windows 2012 R2 server.

I face something I cannot explain.

I draw some formfield into new pdf, then I render the page into a png.

text field, or button or signature are shown  but no checkbox

just like if the fonction UpdateAppearanceStream had no effect on checkbox 

I followed the recommandations here :
https://www.debenu.com/kb/appearance-streams-pdf-form-fields/

(where it is said that generation of appearance streams is (...) supported for (...), checkbox)

and  set SetNeedAppearances(0) then generate Appearance streams in a loop. but nothing helps.

 checkboxes are not shown until I set SetNeedAppearances(1) , open the pdf with acrobat, save it and renderpagetofile


Any Idea is welcomed

here below a sample code :

<?php



$qp = new COM('DebenuPDFLibrary64AX1613.PDFLibrary');

if ($qp->UnlockKey('xxxxxxxxxxxxxxxxxxxxxxxxxxxx') != 1){
    echo ('PDF License validation failed!');
    die();
}


$qp->SetOrigin(1);
$qp->SetMeasurementUnits(0);
$qp->SetNeedAppearances(0);

//direct text to test renderoption(3,1)
$qp->DrawText(20,20, "pipopipo");

//text box is ok
    $fftx_index=  $qp->NewFormField("newtextfield", 1);
    $qp->SetFormFieldBounds($fftx_index, 20, 40 ,30, 15);
    $qp->SetFormFieldValue($fftx_index, "text1");

//checkbox is never shown using page render

   $ffcb_index=  $qp->NewFormField("newcheckbox", 3);

   $qp->SetFormFieldPrintable($ffcb_index,1);
   $qp->SetFormFieldCheckStyle($ffcb_index, 2, 1);
   $qp->SetFormFieldBounds($ffcb_index, 20, 60 ,30, 15);
   $qp->SetFormFieldValue($ffcb_index, "Yes");

   // with or without this block does not change anything
   $qp->AddStandardFont(0);
   $qp->SetFormFieldStandardFont($ffcb_index,0);
   $qp->SetFormFieldBorderColorGray($ffcb_index, 0.5);
   $qp->SetFormFieldBorderStyle($ffcb_index,2,0,0,0);
   $qp->SetFormFieldBackgroundColor($ffcb_index,1.0,0.0,0.0);
   $qp->SetFormFieldAlignment($ffcb_index, 1);
   $qp->SetFormFieldTextSize($ffcb_index, 24);
   $qp->SetFormFieldVisible($ffcb_index, 1);
   // end of with or without this block does not change anything 

   $retour ='';

   for ($i = 1; $i <= $qp->FormFieldCount();$i++){
       if (1== $qp->UpdateAppearanceStream($i)){
           $retour .= ' ok';
       }
   }
   print_r ($retour);


$qp->SaveToFile('./testfile.pdf');

$qp->SetRenderOptions(1, 1);
//$qp->SetRenderOptions(3, 1);  //does not help, checkbox 
$retour = $qp->RenderPageToFile(72, 1, 5, './rendertest.PNG');
echo '<img src="./rendertest.PNG"/>';


?>







Replies:
Posted By: Renaud
Date Posted: 12 Feb 20 at 7:19AM
SOLVED

the parameter SetFormFieldCheckStyle, shall be the last one called.
other wise other parameters are not taken in account.



//create the form
   $ffcb_index=  $qp->NewFormField("newcheckbox", 3);
 //asign all parameters 
   $qp->SetFormFieldBounds($ffcb_index, 20, 60 ,30, 15);

   $qp->SetFormFieldValue($ffcb_index, "Yes");

   $qp->SetFormFieldPrintable($ffcb_index,1);
   $qp->AddStandardFont(0);
   $qp->SetFormFieldStandardFont($ffcb_index,0);
   $qp->SetFormFieldBorderColorGray($ffcb_index, 0.5);
   $qp->SetFormFieldBorderStyle($ffcb_index,2,0,0,0);
   $qp->SetFormFieldBackgroundColor($ffcb_index,1.0,0.0,0.0);
   $qp->SetFormFieldAlignment($ffcb_index, 1);
   $qp->SetFormFieldTextSize($ffcb_index, 24);

// AND LAST ONE SHALL BE STYLE
   $qp->SetFormFieldCheckStyle($ffcb_index, 1, 1);




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk