Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Render Checkbox Stream
  FAQ FAQ  Forum Search   Register Register  Login Login

Render Checkbox Stream

 Post Reply Post Reply
Author
Message
Renaud View Drop Down
Beginner
Beginner
Avatar

Joined: 12 Feb 20
Location: France
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Renaud Quote  Post ReplyReply Direct Link To This Post Topic: Render Checkbox Stream
    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"/>';


?>






Edited by Renaud - 12 Feb 20 at 6:10AM
Back to Top
Renaud View Drop Down
Beginner
Beginner
Avatar

Joined: 12 Feb 20
Location: France
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Renaud Quote  Post ReplyReply Direct Link To This Post 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);

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store