- the source code of this plugin developed using the 4D Plug-in SDK is licensed under the MIT license
- see Poppler for the licensing of Poppler (shared library).
- the licensing of the binary product of this plugin is subject to the licensing of all its dependencies.
Extract text from PDF, convert PDF to SVG.
error:=PDF Convert (pdf;svg;from;to;password;method)
Parameter | Type | Description |
---|---|---|
BLOB | The PDF document BLOB | |
svg | ARRAY PICTURE (or ARRAY TEXT or ARRAY BLOB) | Array to receive the pages (must be defined); See remarks below |
from | LONGINT | Starting page (1 based) [optional] |
to | LONGINT | Ending page (1 based) [optional] |
password | TEXT | Password [optional] |
method | TEXT | Callback method [optional] |
error | LONGINT | Error code |
error:=PDF Get text (pdf;svg;from;to;password;method)
Parameter | Type | Description |
---|---|---|
BLOB | The PDF document BLOB | |
svg | ARRAY TEXT | Array to receive the pages |
from | LONGINT | Starting page (1 based) [optional] |
to | LONGINT | Ending page (1 based) [optional] |
password | TEXT | Password [optional] |
method | TEXT | Callback method [optional] |
error | LONGINT | Error code |
page count (pdf;password)
Parameter | Type | Description |
---|---|---|
BLOB | The PDF document BLOB | |
password | TEXT | Password [optional] |
count | LONGINT | Page count |
$path:=Get 4D folder(Current resources folder)+"sample.pdf"
DOCUMENT TO BLOB($path;$PDF)
ARRAY PICTURE($pages;0)
$startPage:=0
$endPage:=0
$password:=""
$callback:="PDF2SVG_CB_PICTURE"
<>p:=Progress New
Progress SET PROGRESS (<>P;0)
Progress SET BUTTON ENABLED (<>P;True)
$error:=PDF Convert ($PDF;$pages;$startPage;$endPage;$password;$callback)
Progress QUIT (<>P)
$path:=Get 4D folder(Current resources folder)+"sample.pdf"
DOCUMENT TO BLOB($path;$PDF)
ARRAY TEXT($pages;0)
$startPage:=0
$endPage:=0
$password:=""
$callback:="PDF2TEXT_CB"
<>p:=Progress New
Progress SET PROGRESS (<>P;0)
Progress SET BUTTON ENABLED (<>P;True)
$error:=PDF Get text ($PDF;$pages;$startPage;$endPage;$password;$callback)
Progress QUIT (<>P)
The method is executed in the same process as the calling method.
Parameters:
C_LONGINT($1;$pos)//1-based
C_LONGINT($2;$total)
C_LONGINT($3;$pageNumber)//1-based
C_PICTURE($4;$page)
C_BOOLEAN($0;$stop)
To display a progress bar:
Progress SET PROGRESS (<>P;$pos/$total)
To abort:
$0:=Progress Stopped (<>P)
#define PDF2SVG_ERROR_InvalidSourceData (-1)
#define PDF2SVG_ERROR_InvalidReturnType (-2)
#define PDF2SVG_ERROR_AbortedByUser (-3)
Alternatively, you may pass ARRAY TEXT
or ARRAY BLOB
in $2. However, $4 in the callback function will not be used. The current page data will only be passed to the callback method when ARRAY PICTURE
is used. It's main purpose is to display a preview image. Note that the image is a ref-counted duplicate of the final array element.
iconv by cmake may be missing the symbol libiconv_set_relocation_prefix
add a stub function
extern LIBICONV_DLL_EXPORTED void libiconv_set_relocation_prefix (const char *orig_prefix,
const char *curr_prefix){do {} while(0);}
zlib by cmake may be missing the symbol _inflateValidate
normal make
instead