open pdf file in new tab in asp.net c# : Remove text from pdf reader application software utility azure windows winforms visual studio PDFlib-manual3-part1371

2.9  PHP Binding 31
PDF_set_info($p, "Creator", "hello.pl");
PDF_set_info($p, "Author", "Thomas Merz");
PDF_set_info($p, "Title", "Hello world (Perl)");
PDF_begin_page($p, 595, 842);
$font = PDF_load_font($p, "Helvetica-Bold", "host", "");
PDF_setfont($p, $font, 18.0);
PDF_set_text_pos($p, 50, 700);
PDF_show($p, "Hello world!");
PDF_continue_text($p, "(says Perl)");
PDF_end_page($p);
PDF_close($p);
PDF_delete($p);
2.8.3 Error Handling in Perl
The Perl binding installs a special error handler which translates PDFlib errors to native 
Perl exceptions. The Perl exceptions can be dealt with by applying the appropriate lan-
guage constructs, i.e., by bracketing critical sections:
eval {
...some PDFlib instructions...
};
die "Exception caught" if $@;
2.9 PHP Binding
2.9.1 Installing the PDFlib PHP Edition
Detailed information about the various flavors and options for using PDFlib with PHP
1
including the question of whether or not to use a loadable PDFlib module for PHP, can 
be found in the readme.txt file which is part of the PDFlib distribution.
Note We do not recommend using the PDFlib COM edition with PHP. Use the native PDFlib binding 
for PHP instead.
You must configure PHP so that it knows about the external PDFlib library. You have 
two choices:
> Add one of the following lines in php.ini:
extension=libpdf_php.so
; for Unix
extension=php_pdf.dll
; for Windows
PHP will search the library in the directory specified in the extension_dir variable in 
php.ini on Unix, and in the standard system directories on Windows. You can test 
which version of the PHP PDFlib binding you have installed with the following one-
line PHP script:
<?phpinfo()?>
1. See http://www.php.net 
Remove text from pdf reader - delete, remove text from PDF file in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Allow C# developers to use mature APIs to delete and remove text content from PDF document
delete text pdf file; erase pdf text online
Remove text from pdf reader - VB.NET PDF delete text library: delete, remove text from PDF file in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET Programming Guide to Delete Text from PDF File
how to erase pdf text; delete text from pdf
32
Chapter 2:  PDFlib Language Bindings
This will display a long info page about your current PHP configuration. On this page 
check the section titled pdf.  If this section contains PDFlib GmbH Version (and the 
PDFlib version number) you are using the supported new PDFlib wrapper. The un-
supported old wrapper will display PDFlib Version instead.
> Load PDFlib at runtime with one of the following lines at the start of your script:
dl("libpdf_php.so");
# for Unix
dl("php_pdf.dll");
# for Windows
Modified error return for PDFlib functions in PHP. Since PHP uses the convention of re-
turning the value 0 (FALSE) when an error occurs within a function, all PDFlib functions 
have been adjusted to return 0 instead of -1 in case of an error. This difference is noted 
in the function descriptions in Section 7, »API Reference for PDFlib, PDI, and PPS«, page 
135. However, take care when reading the code fragment examples in Section 3, »PDFlib 
Programming«, page 41 since these use the usual PDFlib convention of returning -1 in 
case of an error.
2.9.2 The »Hello world« Example in PHP
<?php
$p = PDF_new();
PDF_open_file($p, "");
PDF_set_info($p, "Creator", "hello.php");
PDF_set_info($p, "Author", "Rainer Schaaf");
PDF_set_info($p, "Title", "Hello world (PHP)");
PDF_begin_page($p, 595, 842); /* start a new page     */
# Change "host" encoding to "winansi" or whatever you need!
$font = PDF_load_font($p, "Helvetica-Bold", "host", "");
PDF_setfont($p, $font, 24.0);
PDF_set_text_pos($p, 50, 700);
PDF_show($p, "Hello world!");
PDF_continue_text($p, "(says PHP)");
PDF_end_page($p);
/* close page*/
PDF_close($p);
/* close PDF document*/
$buf = PDF_get_buffer($p);
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=hello.pdf");
print $buf;
PDF_delete($p);
/* delete the PDFlib object */
?>
2.9.3 Error Handling in PHP
When a PDFlib exception occurs, a PHP exception is thrown. Unfortunately, PHP does 
not yet support structured exception handling: there is no way to catch exceptions and 
C# PDF remove image library: remove, delete images from PDF in C#.
to PDF; Merge PDF Files; Split PDF Document; Remove Password from Image Extract; VB.NET Write: Insert text into PDF; VB.NET Annotate: PDF Markup & Drawing. XDoc.Word
delete text pdf preview; delete text from pdf acrobat
VB.NET PDF remove image library: remove, delete images from PDF in
Remove PDF image in preview without adobe PDF reader component in VB.NET Except PDF text processing function, RasterEdge XDoc.PDF for .NET has image
delete text from pdf file; erase text from pdf file
2.10  Python Binding 33
act appropriately. Do not disable PHP exceptions when using PDFlib, or you will run 
into serious trouble.
PDFlib warnings (nonfatal errors) are mapped to PHP warnings, which can be dis-
abled in php.ini. Alternatively, warnings can be disabled at runtime with a PDFlib func-
tion like in any other language binding:
PDF_set_parameter($p, "warning", "false");
2.10 Python Binding
2.10.1 Installing the PDFlib Python Edition
The Python
1
extension mechanism works by loading shared libraries at runtime. For the 
PDFlib binding to work, the Python interpreter must have access to the PDFlib Python 
wrapper:
Unix. The library pdflib_py.so will be searched in the directories listed in the PYTHON-
PATH environment variable.
Windows. The library pdflib_py.dll will be searched in the directories listed in the PY-
THONPATH environment variable.
2.10.2 The »Hello world« Example in Python
from sys import *
from pdflib_py import *
p = PDF_new()
if PDF_open_file(p, "hello_py.pdf") == -1:
print "Couldn't open PDF file 'hello_py.pdf'\n"
exit(2);
PDF_set_info(p, "Author", "Thomas Merz")
PDF_set_info(p, "Creator", "hello.py")
PDF_set_info(p, "Title", "Hello world (Python)")
PDF_begin_page(p, 595, 842)
font = PDF_load_font(p, "Helvetica-Bold", "host", "")
PDF_setfont(p, font, 18.0)
PDF_set_text_pos(p, 50, 700)
PDF_show(p, "Hello world!")
PDF_continue_text(p, "(says Python)")
PDF_end_page(p)
PDF_close(p)
PDF_delete(p);
1. See http://www.python.org 
VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.
Able to remove a single page from adobe PDF document in VB.NET. Ability to remove consecutive pages from PDF file in VB.NET. Enable
deleting text from a pdf; how to delete text in a pdf acrobat
VB.NET PDF Password Library: add, remove, edit PDF file password
Remove password from PDF. Dim outputFilePath As String = Program.RootPath + "\\" Remove.pdf" ' Remove password in the input file and output to a new file.
remove text watermark from pdf online; remove text from pdf
34
Chapter 2:  PDFlib Language Bindings
2.10.3 Error Handling in Python
The Python binding installs a special error handler which translates PDFlib errors to na-
tive Python exceptions. The Python exceptions can be dealt with by the usual try/catch 
technique:
try:
...some PDFlib instructions...
except:
print 'Exception caught!'
2.11 RPG Binding
PDFlib provides a  /copy module that defines all prototypes and some useful constants 
needed to compile ILE-RPG programs with embedded PDFlib functions.
Since all functions provided by PDFlib are implemented in the C language, you have 
to add x'00' at the end of each string value passed to a PDFlib function. All strings re-
turned from PDFlib will have this terminating x'00' as well.
2.11.1 Compiling and Binding RPG Programs for PDFlib
Using PDFlib functions from RPG requires the compiled PDFlib service program. To in-
clude the PDFlib definitions at compile time you have to specify the name in the D 
specs of your ILE-RPG program:
d/copy QRPGLESRC,PDFLIB
If the PDFlib source file library is not on top of your library list you have to specify the li-
brary as well:
d/copy PDFsrclib/QRPGLESRC,PDFLIB
Before you start compiling your ILE-RPG program you have to create a binding directory 
that includes the PDFLIB service program shipped with PDFlib. The following example 
assumes that you want to create a binding directory called PDFLIB in the library PDFLIB:
CRTBNDDIR BNDDIR(PDFLIB/PDFLIB) TEXT('PDFlib Binding Directory')
After creating the binding directory you need to add the PDFLIB service program to your 
binding directory. The following example assumes that you want to add the service pro-
gram PDFLIB in the library PDFLIB to the binding directory created earlier.
ADDBNDDIRE BNDDIR(PDFLIB/PDFLIB) OBJ((PDFLIB/PDFLIB *SRVPGM))
Now you can compile your program using the CRTBNDRPG command (or option 14 in 
PDM):
CRTBNDRPG PGM(PDFLIB/HELLO) SRCFILE(PDFLIB/QRPGLESRC) SRCMBR(*PGM) DFTACTGRP(*NO)  
BNDDIR(PDFLIB/PDFLIB)
2.11.2 The »Hello world« Example in RPG
*****************************************************************************************
d/copy QRPGLESRC,PDFLIB
*****************************************************************************************
C# PDF Page Delete Library: remove PDF pages in C#.net, ASP.NET
console application. Able to remove a single page from PDF document. Ability to remove a range of pages from PDF file. Free trial package
how to delete text in pdf converter; erase text in pdf document
C# PDF Password Library: add, remove, edit PDF file password in C#
String outputFilePath = Program.RootPath + "\\" Remove.pdf"; // Remove password in the input file and output to a new file. int
remove text watermark from pdf; pdf text watermark remover
2.11  RPG Binding 35
d p               S               *
d font            s             10i 0
*
d error           s             50
*
d filename        s            256
d fontname        s             50
d fontenc         s             50
d infokey         s             50
d infoval         s            200
d text            s            200
d n               s              1    inz(x'00')
*****************************************************************************************
c                   clear                   error
*
   Init on PDFlib
c                   eval      p=pdf_new
c                   if        p=*null
c                   eval      error='Couldn''t create PDFlib object '+
c                                   '(out of memory)!'
c                   exsr      exit
c                   endif
*
   Open new pdf file
c                   eval      filename='hello_rpg.pdf'+x'00'
c                   if        PDF_open_file(p:filename) = -1
c                   eval      error='Cannot open PDF file '+
c                                   %trim(filename)
c                   exsr      exit
c                   endif
   Set info "Creator"
c                   eval      infokey='Creator'+x'00'
c                   eval      infoval='hello.rpg'+x'00'
c                   callp     PDF_set_info(p:infokey:infoval)
   Set info "Author"
c                   eval      infokey='Author'+x'00'
c                   eval      infoval='Thomas Merz'+x'00'
c                   callp     PDF_set_info(p:infokey:infoval)
   Set info "Title"
c                   eval      infokey='Title'+x'00'
c                   eval      infoval='Hello, world (RPG)!'+x'00'
c                   callp     PDF_set_info(p:infokey:infoval)
   Start a new page
c                   callp     PDF_begin_page(p:a4_width:a4_height)
*
c                   eval      fontname='Helvetica-Bold'+x'00'
   Change "host" encoding to "ebcdic" or whatever you need!
c                   eval      fontenc='host'+x'00'
c                   eval      font=PDF_load_font(p:fontname:0:fontenc:n)
*
c                   callp     PDF_setfont(p:font:24)
c                   callp     PDF_set_text_pos(p:50:700)
*
c                   eval      text='Hello world!'+x'00'
c                   callp     PDF_show(p:text)
c                   eval      text='(says ILE RPG)'+x'00'
c                   callp     PDF_continue_text(p:text)
   Close page
C# PDF Digital Signature Library: add, remove, update PDF digital
to PDF; Merge PDF Files; Split PDF Document; Remove Password from Image Extract; VB.NET Write: Insert text into PDF; VB.NET Annotate: PDF Markup & Drawing. XDoc.Word
how to delete text from pdf reader; pdf text remover
C# PDF bookmark Library: add, remove, update PDF bookmarks in C#.
Ability to remove and delete bookmark and outline entry.GetLocation()); Console.WriteLine("Text: " + entry.GetText NET Sample Code: Update PDF Document Outline
remove text from pdf online; how to delete text from pdf
36
Chapter 2:  PDFlib Language Bindings
c                   callp     PDF_end_page(p)
   Close PDF document
c                   callp     PDF_close(p)
   Delete the PDF object
c                   callp     PDF_delete(p)
*
c                   exsr      exit
*****************************************************************************************
c     exit          begsr
c                   if        error<>*blanks
c     error         dsply
c                   endif
c                   seton                                        lr
c                   return
c                   endsr
You can compile this program as follows:
CRTBNDDIR BNDDIR(PDFLIB/PDFLIB) TEXT('PDFlib Binding Directory')
ADDBNDDIRE BNDDIR(PDFLIB/PDFLIB) OBJ((PDFLIB/PDFLIB *SRVPGM))
CRTBNDRPG PGM(PDFLIB/HELLO) SRCFILE(PDFLIB/QRPGLESRC) SRCMBR(*PGM) DFTACTGRP(*NO) +
BNDDIR(PDFLIB/PDFLIB)
2.11.3 Error Handling in RPG
PDFlib clients written in ILE-RPG can install an error handler in PDFlib which will be ac-
tivated when an exception occurs. Since ILE-RPG translates all procedure names to up-
percase, the name of the error handler procedure should be specified in uppercase. The 
following skeleton demonstrates this technique:
*****************************************************************************************
d/copy QRPGLESRC,PDFLIB
*****************************************************************************************
d p               S               *
d font            s             10i 0
*
d error           s             50
*
d errhdl          s               *   procptr
*
 Prototype for exception handling procedure
*
d errhandler      PR
d  p                              *   value
d  type                         10i 0 value
d  shortmsg                   2048
*****************************************************************************************
c                   clear                   error
*
       Set the procedure pointer to the ERRHANDLER procedure.
*
c                   eval      errhdl=%paddr('ERRHANDLER')
*
c                   eval      p=pdf_new2(errhdl:*null:*null:*null:*null)
...PDFlib instructions...
c                   callp     PDF_delete(p)
2.11  RPG Binding 37
*
c                   exsr      exit
*****************************************************************************************
c     exit          begsr
c                   if        error<>*blanks
c     error         dsply
c                   endif
c                   seton                                        lr
c                   return
c                   endsr
*****************************************************************************************
 If any of the PDFlib functions will cause an exception, first the error handler
 will be called and after that we will get a regular RPG exception.
c     *pssr         begsr
c                   exsr      exit
c                   endsr
*****************************************************************************************
 Exception Handler Procedure
 This procedure will be linked to PDFlib by passing the procedure pointer to
 PDF_new2. This procedure will be called when a PDFlib exception occurs.
*
*****************************************************************************************
p errhandler      B
d errhandler      PI
d  p                              *   value
d  type                         10i 0 value
d  c_message                  2048
*
d  length         s             10i 0
*
   Chop off the trailing x'00' (we are called by a C program)
   and set the error (global) string
c                   clear                   error
c     x'00'         scan      c_message     length                   50
c                   sub       1             length
c                   if        *in50 and length>0
c                   if        length>%size(error)
c                   eval      error=c_message
c                   else
c                   eval      error=%subst(c_message:1:length)
c                   endif
c                   endif
*
   Always call PDF_delete to clean up PDFlib
c                   callp     PDF_delete(p)
*
c                   return
*
p errhandler      E
38
Chapter 2:  PDFlib Language Bindings
2.12 Tcl Binding
2.12.1 Installing the PDFlib Tcl Edition
The Tcl 
1
extension mechanism works by loading shared libraries at runtime. For the 
PDFlib binding to work, the Tcl shell must have access to the PDFlib Tcl wrapper shared 
library and the package index file pkgIndex.tcl. You can use the following idiom in your 
script to make the library available from a certain directory (this may be useful if you 
want to deploy PDFlib on a machine where you don’t have root privilege for installing 
PDFlib):
lappend auto_path /path/to/pdflib
Unix. The library pdflib_tcl.so must be placed in one of the default locations for shared 
libraries, or in an appropriately configured directory. Usually both pkgIndex.tcl and 
pdflib_tcl.so will be placed in the directory
/usr/lib/tcl8.3/pdflib
Windows. The files pkgIndex.tcl and pdflib_tcl.dll  will be searched for in the directories
C:\Program Files\Tcl\lib\pdflib
C:\Program Files\Tcl\lib\tcl8.3\pdflib
2.12.2 The »Hello world« Example in Tcl
package require pdflib 5.0.1
set p [PDF_new]
if {[PDF_open_file $p "hello_tcl.pdf"] == -1} {
puts stderr "Couldn't open PDF file!"
exit
}
PDF_set_info $p "Creator" "hello.tcl"
PDF_set_info $p "Author" "Thomas Merz"
PDF_set_info $p "Title" "Hello world (Tcl)"
PDF_begin_page $p 595 842
set font [PDF_load_font $p "Helvetica-Bold" "host" "" ]
PDF_setfont $p $font 18.0
PDF_set_text_pos $p 50 700
PDF_show $p "Hello world!"
PDF_continue_text $p "(says Tcl)"
PDF_end_page $p
PDF_close $p
PDF_delete $p
1. See http://dev.scriptics.com 
2.12  Tcl Binding 39
2.12.3 Error Handling in Tcl
The Tcl binding installs a special error handler which translates PDFlib errors to native 
Tcl exceptions. The Tcl exceptions can be dealt with by the usual try/catch technique:
if [ catch { ...some PDFlib instructions... } result ] {
puts stderr "Exception caught!"
puts stderr $result
}
40
Chapter 2:  PDFlib Language Bindings
Documents you may be interested
Documents you may be interested