pdf viewer in asp.net c# : How to add an image to a pdf control application platform web page azure .net web browser cpdfmanual2-part639

Chapter 3
Pages
cpdf -scale-page "<scale x> <scale y>" in.pdf [<range>] -o out.pdf
cpdf -scale-to-fit "<x size> <y size>" [-scale-to-fit-scale <scale>]
in.pdf [<range>] -o out.pdf
cpdf -scale-contents [<scale>] [<position>] in.pdf [<range>] -o out.pdf
cpdf -shift "<shift x> <shift y>" in.pdf [<range>] -o out.pdf
cpdf -rotate <angle> in.pdf [<range>] -o out.pdf
cpdf -rotateby <angle> in.pdf [<range>] -o out.pdf
cpdf -rotate-contents <angle> in.pdf [<range>] -o out.pdf
cpdf -upright in.pdf [<range>] -o out.pdf
cpdf -hflip in.pdf [<range>] -o out.pdf
cpdf -vflip in.pdf [<range>] -o out.pdf
cpdf -mediabox "<x> <y> <w> <h>" in.pdf [<range>] -o out.pdf
cpdf -crop "<x> <y> <w> <h>" in.pdf [<range>] -o out.pdf
cpdf -remove-crop in.pdf [<range>] -o out.pdf
cpdf -frombox <boxname> -tobox <boxname> [-mediabox-if-missing]
in.pdf [<range>] -o out.pdf
3.1 PageSizes
Anytimewhenapagesizeisrequired,insteadofwriting,forinstance"210mm 197mm"one
caninsteadwritea4portrait.Hereisalistofsupportedpagesizes:
13
How to add an image to a pdf - insert images into PDF in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Sample C# code to add image, picture, logo or digital photo into PDF document page using PDF page editor control
add image to pdf in preview; add image field to pdf form
How to add an image to a pdf - VB.NET PDF insert image library: insert images into PDF in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Guide VB.NET Programmers How to Add Images in PDF Document
add an image to a pdf; add signature image to pdf acrobat
14
CHAPTER3. PAGES
a0portrait
a1portrait
a2portrait
a3portrait
a4portrait
a5portrait
a6portrait
a7portrait
a8portrait
a9portrait
a10portrait
a0landscape
a1landscape
a2landscape
a3landscape
a4landscape
a5landscape
a6landscape
a7landscape
a8landscape
a9landscape
a10landscape
usletterportrait
usletterlandscape
uslegalportrait
uslegallandscape
3.2 ScalePages
The-scale-pageoperationscaleseachpageintherangebytheXandYfactorsgiven.This
scalesboththepagecontents,andthepagesizeitself.ItalsoscalesanyCropBoxandother
boxes(ArtBox,TrimBoxetc). Aswithseveralofthesecommands,remembertotakeinto
accountanypagerotationwhenconsideringwhattheXandYaxesrelateto.
cpdf -scale-page "2 2" in.pdf -o out.pdf
ConvertanA4pagetoA3,forinstance.
The-scale-to-fitoperationscaleseachpageintherangetofitagivenpagesize,preserving
aspectratioandcenteringtheresult.
cpdf -scale-to-fit "297mm 210mm" in.pdf -o out.pdf
cpdf -scale-to-fit a4portrait in.pdf -o out.pdf
Scaleafile’spagestofitA4portrait.
Thescalecanoptionallybesettoapercentageoftheavailablearea,insteadoffillingit.
cpdf -scale-to-fit a4portrait -scale-to-fit-scale 0.9 in.pdf -o out.pdf
Scaleafile’spagestofitA4portrait,scalingthepage90%ofitspossiblesize.
The-scale-contentsoperationscalesthecontentsaboutthecenterofthecropbox(or,if
absent,themediabox),leavingthepagedimensions(boxes)unchanged.
cpdf -scale-contents 0.5 in.pdf -o out.pdf
Scaleafile’scontentsonallpagesto50%ofitsoriginaldimensions.
C# PDF Image Extract Library: Select, copy, paste PDF images in C#
Get image information, such as its location, zonal information, metadata, and so on. Able to edit, add, delete, move, and output PDF document image.
add jpeg signature to pdf; add image to pdf acrobat
VB.NET PDF Password Library: add, remove, edit PDF file password
VB: Add Password to PDF with Permission Settings Applied. This VB.NET example shows how to add PDF file password with access permission setting.
add image pdf acrobat; how to add a jpg to a pdf
3.3. SHIFTPAGECONTENTS
15
Toscaleaboutapointotherthanthecenter,onecanusethepositioningcommandsdescribedin
Section8.2.4.Forexample:
cpdf -scale-contents 0.5 -topright 20 in.pdf -o out.pdf
Scaleafile’scontentsonallpagesto50%ofitsoriginaldimensionsaboutapoint20ptsfromitstop
rightcorner.
3.3 ShiftPageContents
The-shiftoperationshiftsthecontentsofeachpageintherangebyXpointshorizontally
andYpointsvertically.
cpdf -shift "50 0" in.pdf even -o out.pdf
Shiftpagestotherightby50points(forinstance,toincreasethebindingmargin).
3.4 RotatingPages
Therearetwowaysofrotatingpages:(1)settingavalueinthePDFfilewhichaskstheviewer
(e.g.Acrobat)torotatethepageon-the-flywhenviewingit(use-rotateor-rotateby)and
(2)actuallyrotatingthepagecontentsand/orthepagedimensions(use-uprightafterwards
or-rotate-contentstojustrotatethepagecontents).
Thepossiblevaluesfor-rotateand-rotate-byare0,90,180and270,allinterpretedas
beingclockwise.Anyvaluemaybeusedfor-rotate-contents.
The-rotateoperationsetstheviewingrotationoftheselectedpagestotheabsolutevalue
given.
cpdf -rotate 90 in.pdf -o out.pdf
Settherotationofallthepagesintheinputfiletoninetydegreesclockwise.
The-rotatebyoperationchangestheviewingrotationofallthegivenpagesbytherelative
valuegiven.
cpdf -rotateby 90 in.pdf -o out.pdf
Rotateallthepagesintheinputfilebyninetydegreesclockwise.
The-rotate-contentsoperationrotatesthecontentsanddimensionsofthepagebythe
givenrelativevalue.
VB.NET PDF Image Extract Library: Select, copy, paste PDF images
DLLs for PDF Image Extraction in VB.NET. In order to run the sample code, the following steps would be necessary. Add necessary references:
add picture to pdf reader; adding a jpg to a pdf
C# PDF Password Library: add, remove, edit PDF file password in C#
C# Sample Code: Add Password to PDF with Permission Settings Applied in C#.NET. This example shows how to add PDF file password with access permission setting.
add jpeg to pdf; adding jpg to pdf
16
CHAPTER3. PAGES
cpdf -rotate-contents 90 in.pdf -o out.pdf
Rotateallthepagecontentsintheinputfilebyninetydegreesclockwise.Doesnotchangethepage
dimensions.
The-uprightoperationdoeswhatevercombinationof-rotateand-rotate-contents
isrequiredtochangetherotationofthedocumenttozerowithoutalteringitsappearance.
3.5 FlippingPages
The-hflipand-vflipoperationsflipthecontentsofthechosenpageshorizontallyor
vertically.Noaccountistakenofthecurrentpagerotationwhenconsideringwhat”horizontally”
and”vertically”mean,soyoumayliketouse-uprightfirst.
cpdf -hflip in.pdf even -o out.pdf
Fliptheevenpagesinin.pdfhorizontally.
cpdf -vflip in.pdf -o out.pdf
Flipallthepagesinin.pdfvertically.
3.6 BoxesandCropping
AllPDFfilescontainamediaboxforeachpage,givingthedimensionsofthepaper.Tochange
thesedimensions(withoutalteringthepagecontentsinanyway),usethe-mediaboxoption.
cpdf -mediabox "0pt 0pt 500pt 500pt" in.pdf -o out.pdf
Setthemediaboxto500pointssquare.
Thefournumbersareminimumx,minimumy,width,height.xcoordinatesincreasetothe
right,ycoordinatesincreaseupwards.PDFfilecanalsooptionallycontainacropboxforeach
page,definingtowhatextentthepageiscroppedbeforebeingdisplayedorprinted.Acropbox
canbeset,changedandremoved,withoutaffectingtheunderlyingmediabox.Tosetorchange
thecropboxuse-crop.Toremoveanyexistingcropbox,use-remove-crop.
cpdf -crop "0pt 0pt 200mm 200mm" in.pdf -o out.pdf
Croppagestothebottomleft200-millimetersquareofthepage.
cpdf -remove-crop in.pdf -o out.pdf
Removecropping.
C# Create PDF from images Library to convert Jpeg, png images to
List<Bitmap> images = new List<Bitmap>(); images.Add(new Bitmap(Program.RootPath + "\\" 1.gif")); / Build a PDF document with GIF image.
add image to pdf form; adding image to pdf in preview
C# PDF Sticky Note Library: add, delete, update PDF note in C#.net
C#.NET PDF SDK - Add Sticky Note to PDF Page in C#.NET. Able to add notes to PDF using C# source code in Visual Studio .NET framework.
add png to pdf acrobat; how to add image to pdf document
3.6. BOXESANDCROPPING
17
Notethatthecropboxisonlyobeyedinsomeviewers.
cpdf -frombox <boxname> -tobox <boxname> [-mediabox-if-missing]
in.pdf [<range>] -o out.pdf
Copythecontentsofoneboxtoanother.
Thisoperationcopiesthecontentsofonebox(Mediabox,Cropbox,Trimboxetc.)toanother.If
-mediabox-if-missingisadded,themediaboxwillbesubstitutedwhenthe’from’boxis
notsetforagivenpage.Forexample
cpdf -frombox /TrimBox -tobox /CropBox in.pdf -o out.pdf
copiestheTrimBoxofeachpagetotheCropBoxofeachpage. Thepossibleboxesare
/MediaBox,/CropBox,/BleedBox,/TrimBox,/ArtBox.
C# PDF remove image library: remove, delete images from PDF in C#.
C# Read: PDF Image Extract; C# Write: Insert text into PDF; C# Write: Add Image to PDF; Remove Image from PDF Page Using C#. Add necessary references:
how to add image to pdf file; add jpg to pdf acrobat
VB.NET PDF remove image library: remove, delete images from PDF in
C# Read: PDF Image Extract; C# Write: Insert text into PDF; C# Write: Add Image to PDF; VB.NET: Remove Image from PDF Page. Add necessary references:
add a picture to a pdf document; add photo to pdf online
18
CHAPTER3. PAGES
Chapter 4
Encryption and Decryption
cpdf -encrypt <method> <owner> <user>
[-no-encrypt-metadata] <permissions> in.pdf -o out.pdf
cpdf -decrypt in.pdf owner=<owner password> -o out.pdf
4.1 Introduction
PDFfilescanbeencryptedusingvarioustypesofencryptionandattachingvariouspermissions
describingwhatsomeonecan dowithaparticulardocument(forinstance,printingitor
extractingcontent).Therearetwotypesofperson:
TheUsercandotothedocumentwhatisallowedinthepermissions.
TheOwner candoanything,includingalteringthepermissionsorremovingencryption
entirely.
Therearefivekindsofencryption:
 40-bitencryption(method40bit)inAcrobat3(PDF1.1)andabove
 128-bitencryption(method128bit)inAcrobat5(PDF1.4)andabove
 128-bitAESencryption(methodAES)inAcrobat7(PDF1.6)andabove
 256-bitAESencryption(methodAES256)inAcrobat9(PDF1.7)–thisisdeprecated–do
notusefornewdocuments
 256-bitAESencryption(methodAES256ISO)inPDF2.0
Allencryptionsupportsthesekindsofpermissions:
-no-edit
Cannotchangethedocument
-no-print
Cannotprintthedocument
-no-copy
Cannotselectorcopytextorgraphics
-no-annot
Cannotaddorchangeformfieldsorannotations
19
20
CHAPTER4. ENCRYPTIONANDDECRYPTION
Inaddition,128-bitencryption(Acrobat5andabove)andAESencryptionsupportsthese:
-no-forms
Cannoteditformfields
-no-extract
Cannotextracttextorgraphics
-no-assemble
Cannotmergefilesetc.
-no-hq-print
Cannotprinthigh-quality
Addtheseflagstothecommandlinetopreventeachoperation.
4.2 EncryptingaDocument
Toencryptadocument,theowneranduserpasswordsmustbegiven(here,fredandcharles
respectively):
cpdf -encrypt 40bit fred charles -no-print in.pdf -o out.pdf
cpdf -encrypt 128bit fred charles -no-extract in.pdf -o out.pdf
cpdf -encrypt AES fred "" -no-edit -no-copy in.pdf -o out.pdf
Ablankuserpasswordiscommon.Inthisevent,PDFviewerswilltypicallynotpromptfora
passwordforwhenopeningthefileorforoperationsallowablewiththeuserpassword.
cpdf -encrypt AES256 fred "" -no-forms in.pdf -o out.pdf
Inaddition,theusualmethodcanbeusedtogivetheexistingownerpassword,ifthedocument
isalreadyencrypted.
WhenusingAESencryption,theoptionisavailabletorefrainfromencryptingthemetadata.
Add-no-encrypt-metadatatothecommandline.
4.3 DecryptingaDocument
Todecryptadocument,theownerpasswordisprovided.
cpdf -decrypt in.pdf owner=fred -o out.pdf
Theuserpasswordcannotdecryptafile.
Chapter 5
Compression
cpdf -decompress in.pdf -o out.pdf
cpdf -compress in.pdf -o out.pdf
cpdfprovidesbasicfacilitiesfordecompressingandcompressingPDFstreams.
5.1 DecompressingaDocument
TodecompressthestreamsinaPDFfile,forinstancetomanuallyinspectthePDF,use:
cpdf -decompress in.pdf -o out.pdf
Ifcpdffindsacompressiontypeitcan’tcopewith,thestreamisleftcompressed.Whenusing
-decompress,objectstreamsarenotcompressed.
5.2 CompressingaDocument
TocompressthestreamsinaPDFfile,use:
cpdf -compress in.pdf -o out.pdf
cpdfcompressesanystreamswhichhavenocompressionusingtheFlateDecodemethod,with
theexceptionofMetadatastreams,whichareleftuncompressed.
21
22
CHAPTER5. COMPRESSION
Documents you may be interested
Documents you may be interested