function nvpdf_WrapString($my_pdf,$string,$width,$width_in_chars = "") {
// known problem: can only be called after the pdf document has been
// started, font size set, etc as it relies on the pdf being in the
// page scope to use pdf_stringwidth (see PDFLib manual p.83).
// returns an array: 1st level column
// 2nd level data string broken up into lines that fit the column
$string = str_replace('n', "n", $string);
$inlines = explode("n",$string);
$outlines = array();
$font_size = PDF_get_option($my_pdf, "fontsize", "");
$font_name = pdf_get_parameter($my_pdf, "fontname", 0);
$font_id = PDF_load_font($my_pdf, $font_name, "host","");
I got a deprecation warning from php saying that I should use pdf_get_option() instead of pdf_get_parameter(). But how can I convert this pdf_get_parameter() to pdf_get_option()?
I need a method that will return me the font name of $mypdf.
2
Answers
Found the solve. pdf_get_option() wont give me the font name. All I have to do is use pdf_info_font() and then use pdf_get_string() to get the fontname.
nice that you could find the solution yourself.
Another quick note: If you have found a deprecated warning for a PDFlib function, it is recommended to replace it even if the functionality still works in the version you are using. This is because the deprecated function may no longer be available when updating.
The current PDFlib 9 and 10 packages include a PDFlib Migration Guide which describes all necessary changes in detail.
You can also find the latest PDFlib 10 Migration Guide on the PDFlib Web site pdflib.com.
for this particular question you would find the explanation in chapter 2.1 table 2.3:
A sample usage is also available in the PDFlib cookbook "font/font_info".