﻿

# c# pdf reader writer : Delete pages from pdf control application platform web page azure winforms web browser TeXbyTopic7-part937

Chapter5. Boxes
iscompletelyequivalenttojust
\vbox{...}
Itwasstatedabovethatthedepthofa\vboxiszeroifthelastitemisakernorglue,and
theheightofa\vtopiszerounlesstheﬁrstiteminitisabox.Theaboveexamplesuseda
kernforthatﬁrstorlastitem,butif,inthecaseofa\vtop,thisitemisnotaglueorkern,
oneisapttooverlooktheeffectthatithasonthesurroundingbox.Forinstance,
\vtop{\write16{...}...}
haszeroheight,becausethewriteinstructionispackedintoa‘whatsit’itemthatisplaced
onthecurrent,thatis,thevertical,list.Theremedyhereis
\vtop{\leavevmode\write16{...}...}
rencebetweenhowverticalandhorizontalboxesaretreatedinaverticallist.Considerthe
followingexamples.After\offinterlineskiptheﬁrstexample
\vbox{\hbox{a}
\setbox0=\vbox{\hbox{(}}
\ht0=0pt \dp0=0pt \box0
\hbox{ b}}
gives
a
(b
whileaslightvariant
\vbox{\hbox{a}
\setbox0=\hbox{(}
\ht0=0pt \dp0=0pt \box0
\hbox{ b}}
gives
a
(
b
Thedifferenceiscausedbythefactthathorizontalboxesareplacedwithrespecttotheir
referencepoint,butverticalboxeswithrespecttotheirupperleftcorner.
5.9.5
Hangingthe\lastboxbackinthelist
Youcanpickthelastboxoffaverticallistthathasbeencompiledin(internal)vertical
mode.However,ifyoutrytohangitbackinthelisttheverticalspacingmaygohaywire.
Ifyoujusthangitback,
\setbox\tmpbox=\lastbox
\usethetmpbox \box\tmpbox
\setbox\tmpbox=\lastbox \unskip
\usethetmpbox \box\tmpbox
70
VictorEijkhout–T
E
XbyTopic
Delete pages from pdf - remove PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Provides Users with Mature Document Manipulating Function for Deleting PDF Pages
delete page on pdf file; cut pages from pdf reader
Delete pages from pdf - VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Visual Basic Sample Codes to Delete PDF Document Page in .NET
delete pdf pages acrobat; delete pages from pdf without acrobat
5.9. Assortedremarks
thingsgowronginamoresubtleway.Theinternaldimen\prevdepth(whichcontrols
interlineglue;seeChapter15)willhaveavaluebasedonthelastbox,butwhatyouneed
unskip,buttospecify\nointerlineskip:
\setbox\tmpbox=\lastbox
\usethetmpbox \nointerlineskip \box\tmpbox
5.9.6
Dissectingparagraphswith\lastbox
Repeatedlyapplying\last...and\un...macroscanbeusedtotakeaparagraphapart.
Hereisanexampleofthat.
inrecentyearsthatissomewherebetweenﬂushrightandraggedrightsetting.Linesthat
wouldstretchbeyondcertainlimitsaresetwiththeirglueatnaturalwidth.Thisparagraph
exempliﬁesthisprocedure;themacrosfollownext.
\newbox\linebox \newbox\snapbox
\def\eatlines{
\setbox\linebox\lastbox
% check the last line
\ifvoid\linebox
\else
% if it’s not empty
\unskip\unpenalty
% take whatever is
{\eatlines}
% above it;
% collapse the line
\setbox\snapbox\hbox{\unhcopy\linebox}
% depending on the difference
\ifdim\wd\snapbox<.98\wd\linebox
\box\snapbox % take the one or the other,
\else \box\linebox \fi
\fi}
Thismacrocanbecalledas
\vbox{ ... some text ... \par\eatlines}
oritcanbeinsertedautomaticallywith\everypar;see[10].
Inthemacro\eatlines,the\lastboxistakenfromaverticallist.Ifthelistisempty
thelastboxwilltesttrueon\ifvoid.Theseboxescontaininglinesfromaparagraphare
actuallyhorizontalboxes:thetest\ifhboxappliedtothemwouldgiveatrueresult.
VictorEijkhout–T
E
XbyTopic
71
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
C# view PDF online, C# convert PDF to tiff, C# read PDF, C# convert PDF to text, C# extract PDF pages, C# comment annotate PDF, C# delete PDF pages, C# convert
delete a page from a pdf in preview; acrobat export pages from pdf
C# PDF Page Insert Library: insert pages into PDF file in C#.net
how to merge PDF document files by C# code, how to rotate PDF document page, how to delete PDF page using C# .NET, how to reorganize PDF document pages and how
delete pdf pages android; delete pages in pdf reader
Chapter 6
Horizontaland VerticalMode
AtanypointinitsprocessingT
E
Xisinsomemode.Therearesixmodes,dividedinthree
categories:
1.
horizontalmodeandrestrictedhorizontalmode,
2.
verticalmodeandinternalverticalmode,and
3.
mathmodeanddisplaymathmode.
Themathmodeswillbetreatedelsewhere(seepage201).Hereweshalllookattheho-
rizontalandverticalmodes,thekindsofobjectsthatcanoccurinthecorrespondinglists,
andthecommandsthatareexclusiveforonemodeortheother.
\ifhmode Testwhetherthecurrentmodeis(possiblyrestricted)horizontalmode.
\ifvmode Testwhetherthecurrentmodeis(possiblyinternal)verticalmode.
\ifinner Testwhetherthecurrentmodeisaninternalmode.
\showlists Writetothelogﬁlethecontentsofthepartiallistscurrentlybeingbuiltin
allmodes.
6.1
Horizontalandverticalmode
When not typesettingmathematics,T
E
Xisin horizontal or vertical mode, building ho-
rizontalorverticallistsrespectively.Horizontalmodeistypically used to makelinesof
text;verticalmodeistypicallyusedtostackthelinesofaparagraphontopofeachother.
NotethatthesemodesaredifferentfromtheinternalstatesofT
E
X’sinputprocessor(see
page31).
6.1.1
Horizontalmode
Themainactivityinhorizontalmodeisbuildinglinesoftext.Textonthepageandtextin
a\vboxor\vtopisbuiltinhorizontalmode(thismightbecalled‘paragraphmode’);if
thetextisinan\hboxthereisonlyonelineoftext,andthecorrespondingmodeisthe
restrictedhorizontalmode.
72
VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
Page: Insert PDF Pages. |. Home ›› XDoc.PDF ›› VB.NET PDF: Insert PDF Page. Add and Insert Multiple PDF Pages to PDF Document Using VB.
delete a page from a pdf file; cut pages from pdf preview
VB.NET PDF Page Extract Library: copy, paste, cut PDF pages in vb.
C:\test1.pdf") Dim pdf2 As PDFDocument = New PDFDocument("C:\test2.pdf") Dim pageindexes = New Integer() {1, 2, 4} Dim pages = pdf.DuplicatePage(pageindexes
delete a page from a pdf online; delete pages from pdf in reader
6.2. Horizontalandverticalcommands
Eachelementofahorizontallistisoneofthefollowing:
abox(acharacter,ligature,\vrule,orabox),
awhatsit(seeChapter30),
theydisappearinabreak.BreakingofhorizontallistsistreatedinChapter19.
6.1.2
Verticalmode
Verticalmodecanbeusedto stackitemsontopofoneanother.Mostofthetime,these
itemsareboxescontainingthelinesofparagraphs.
Stackingmaterialcantakeplaceinsideaverticalbox,buttheitemsthatarestackedcan
alsoappearbythemselvesonthepage.InthelattercaseT
E
Xisinverticalmode;inthe
formercase,insideaverticalbox,T
E
Xoperatesininternalverticalmode.
mode,itwilllaterbebrokenwhenpagesareformed.
Eachelementofaverticallistisoneofthefollowing:
abox(ahorizontalorverticalboxoran\hrule),
awhatsit,
amark,
ter27.
Therearea few exceptional conditionsat thebeginning ofa vertical list: thevalueof
internalverticallist;atthetopofthemainverticallist(thetopofthe‘currentpage’)no
isplacedonthislist(seeChapters26and27).
6.2
Horizontalandverticalcommands
SomecommandsaresointrinsicallyhorizontalorverticalinnaturethattheyforceT
E
Xto
gointothatmode,ifpossible.AcommandthatforcesT
E
Xintohorizontalmodeiscalleda
horizontalcommand;similarlyacommandthatforcesT
E
Xintoverticalmodeiscalleda
verticalcommand.
However,notalltransitionsarepossible:T
E
Xcanswitchfrombothverticalmodesto(un-
restricted)horizontal modeandbackthroughhorizontalandvertical commands,but no
VictorEijkhout–T
E
XbyTopic
73
C# PDF Page Extract Library: copy, paste, cut PDF pages in C#.net
C#.NET PDF Library - Copy and Paste PDF Pages in C#.NET. Easy to C#.NET Sample Code: Copy and Paste PDF Pages Using C#.NET. C# programming
delete pdf pages in reader; delete pages in pdf online
VB.NET PDF delete text library: delete, remove text from PDF file
VB.NET PDF - How to Delete Text from PDF File in VB.NET. VB.NET Programming Guide to Delete Text from PDF File Using XDoc.PDF SDK for VB.NET.
delete pages on pdf file; delete pages in pdf
Chapter6. HorizontalandVerticalMode
transitionstoorfromrestrictedhorizontalmodearepossible(otherthanbyenclosingho-
rizontalboxesinverticalboxesortheotherwayaround).Averticalcommandinrestricted
horizontalmodethusgivesanerror;the\parcommandinrestrictedhorizontalmodehas
noeffect.
Thehorizontalcommandsarethefollowing:
any letter, otherchar, \char, acontrol sequence deﬁned by \chardef, or
\noboundary;
\accent,\discretionary,thediscretionaryhyphen\-andcontrolspace\;
\unhboxand\unhcopy;
\vruleandthehorizontalskipcommands\hskip,\hfil,\hfill,\hss,and
\hfilneg;
\valign;
mathshift(\$).
Theverticalcommandsarethefollowing:
\unvboxand\unvcopy;
\hruleandtheverticalskipcommands\vskip,\vfil,\vfill,\vss,and
\vfilneg;
\halign;
\endand\dump.
Notethattheverticalcommandsdonotinclude\par;norare\indentand\noindent
horizontalcommands.
Theconnectionbetweenboxesandmodesisexploredbelow;seeChapter9formoreon
theconnectionbetweenrulesandmodes.
6.3
Theinternalmodes
Restrictedhorizontalmodeandinternalverticalmodearethevariantsofhorizontalmode
andverticalmodethatholdinsidean\hboxand\vbox(or\vtopor\vcenter)respec-
tively.However,restrictedhorizontalmodeisrathermorerestrictedinnaturethaninternal
verticalmode.Thethirdinternalmodeisnon-displaymathmode(seeChapter23).
6.3.1
Restrictedhorizontalmode
Themaindifferencebetweenrestrictedhorizontalmode,themodeinan\hbox,andunre-
strictedhorizontalmode,themodeinwhichparagraphsinverticalboxesandonthepage
arebuilt,isthatyoucannotbreakoutofrestrictedhorizontalmode:\pardoesnothingin
thismode.Furthermore,averticalcommandinrestrictedhorizontalmodegivesanerror.
In unrestrictedhorizontal modeitwould causea\partokentobeinsertedandvertical
modetobeentered(seealsoChapter17).
74
VictorEijkhout–T
E
XbyTopic
C# Word - Delete Word Document Page in C#.NET
doc.Save(outPutFilePath); Delete Consecutive Pages from Word in C#. int[] detelePageindexes = new int[] { 1, 3, 5, 7, 9 }; // Delete pages.
add and delete pages in pdf online; delete pages from a pdf document
delete a page from a pdf online; add remove pages from pdf
6.4. Boxesandmodes
6.3.2
Internalverticalmode
Internalverticalmode,theverticalmodeinsidea\vbox,isalotlikeexternalverticalmode,
themodeinwhichpagesarebuilt.Ahorizontalcommandininternalverticalmode,for
instance,isperfectlyvalid:T
E
Xthenstartsbuildingaparagraphinunrestrictedhorizontal
mode.
Onedifferenceisthat thecommands\unskipand \unkernhavenoeffectinexternal
verticalmode,and\lastboxisalwaysemptyinexternalverticalmode.Seefurtherpages
60and96.
Theentriesofalignments(seeChapter25)areprocessedininternalmodes:restrictedho-
rizontalmodefortheentriesofan\halign,andinternalverticalmodefortheentriesof
verticalmode;furthermore,T
E
Xentersthismodewhenprocessingthe\outputtokenlist.
Thecommands\endand\dump(thelatterexistsonlyinIniT
E
X)arenotallowedininternal
verticalmode;furthermore,\dumpisnotallowedinsideagroup(seeChapter33).
6.4
Boxesandmodes
Therearehorizontal and vertical boxes, and thereishorizontaland verticalmode.Not
thisconnectionintwoways.
6.4.1
Whatboxdoyouuseinwhatmode?
Thisisthewrongquestion.Bothhorizontalandverticalboxescanbeusedinbothhori-
zontal and verticalmode.Theirplacementisdetermined by theprevailing modeatthat
moment.
6.4.2
Whatmodeholdsinwhatbox?
Thisistherightquestion.Whenan\hboxstarts,T
E
Xisinrestrictedhorizontalmode.Thus
everythinginahorizontalboxislineduphorizontally.
Whena\vboxisstarted,T
E
Xisininternalverticalmode.Boxesofbothkindsandother
itemsarethenstackedontopofeachother.
6.4.3
Mode-dependentbehaviourofboxes
Anybox(seeChapter5forthefulldeﬁnition)can beusedinhorizontal,vertical,and
math mode.Unboxingcommands,however,arespeciﬁcforhorizontalorverticalmode.
Both\unhboxand\unhcopyarehorizontalcommands,sotheycanmakeT
E
Xswitch
fromverticaltohorizontalmode;both\unvboxand\unvcopyareverticalcommands,
sotheycanmakeT
E
Xswitchfromhorizontaltoverticalmode.
VictorEijkhout–T
E
XbyTopic
75
Chapter6. HorizontalandVerticalMode
Inhorizontalmodethe\spacefactorissetto1000afteraboxhasbeenplaced.Inverti-
calmodethe\prevdepthissettothedepthoftheboxplaced.Neitherstatementholdsfor
unboxingcommands:afteran\unhboxor\unhcopythespacefactorisnotaltered,andaf-
ter\unvboxor\unvcopythe\prevdepthremainsunchanged.Afterall,thesecommands
Theoperations\raise and \lowercan only beapplied to abox in horizontal mode;
similarly,\moveleftand\moverightcanonlybeappliedinverticalmode.
6.5
Modesandglue
BothinhorizontalandverticalmodeT
E
Xcaninsertglueitemsthesizeofwhichisdeter-
minedbytheprecedingobjectinthelist.
Forhorizontalmodetheamountofgluethatisinsertedforaspacetokendependsonthe
\spacefactorofthepreviousobjectinthelist.ThisistreatedinChapter20.
InverticalmodeT
E
Xinsertsgluetokeepboxesatacertaindistancefromeachother.This
glueisinﬂuencedbytheheightofthecurrentitemandthedepthofthepreviousone.The
depthofitemsisrecordedinthe\prevdepthparameter(seeChapter15).
Thetwoquantities\prevdepthand\spacefactorusethesameinternalregisterofT
E
X.
onlyinhorizontalmode.
6.6
Migratingmaterial
(theﬁrsttwocanalsooccurinverticalmode)tospecifymaterialthatwillwinduponthe
surroundingverticallist.Notethatthisneednotbethemainverticallist:itcanbeavertical
boxcontainingaparagraphoftext.Inthiscasea\markor\insertcommandwill not
reachthepagebreakingalgorithm.
Whenseveralmigratingitemsarespeciﬁedinacertainlineoftext,theirleft-to-rightorder
ispreservedwhentheyareplacedonthesurroundingverticallist.Theseitemsareplaced
directlyafterthehorizontalboxcontainingthelineoftextinwhichtheywerespeciﬁed:
theycomebeforeanypenaltyorglueitemsthatareautomaticallyinserted(seepage178).
6.6.1
Thecommand
isonlyallowedinhorizontalandmathmodes(butitisnotahorizontalcommand).Ver-
commandisgiventothesurroundingverticallist,directlyaftertheboxinwhichitoccur-
red.
76
VictorEijkhout–T
E
XbyTopic
6.7. Testingmodes
Anyvertical material in a\vadjustitem isprocessed in internal vertical mode, even
thoughitwillwinduponthemainverticallist.Forinstance,the\ifinnertestistrueina
6.7
Testingmodes
Thethreeconditionals\ifhmode,\ifvmode,and\ifinnercandistinguishbetweenthe
fourmodesofT
E
Xthatarenotmathmodes.The\ifinnertestistrueifT
E
Xisinrestric-
tedhorizontalmodeorinternalverticalmode(orinnon-displaymathmode).Exceptional
condition:duringa\writeT
E
Xisina‘nomode’state.Thetests\ifhmode,\ifvmode,
and\ifmmodearethenallfalse.
Inspectionofallcurrentlists,includingthe‘recentcontributions’(seeChapter27),ispos-
siblethroughthecommand\showlists.Thiscommandwritestothelogﬁlethecontents
ofallliststhatarebeingbuiltatthemomentthecommandisgiven.
Considertheexample
a\hfil\break b\par
c\hfill\break d
\hbox{e\vbox{f\showlists
currentpage.Thesecondparagraphhasnotbeenconcludedorbrokenintolines.
Thelogﬁleshowsthefollowing.T
E
Xwas busybuilding aparagraph (starting with an
indentationbox20ptwide):
### horizontal mode entered at line 3
\hbox(0.0+0.0)x20.0
\tenrm f
spacefactor 1000
Thisparagraphwasinsideaverticalbox:
### internal vertical mode entered at line 3
prevdepth ignored
Theverticalboxwasinahorizontalbox,
### restricted horizontal mode entered at line 3
\tenrm e
spacefactor 1000
whichwaspartofanas-yetunﬁnishedparagraph:
### horizontal mode entered at line 2
\hbox(0.0+0.0)x20.0
\tenrm c
\glue 0.0 plus 1.0fill
\penalty -10000
\tenrm d
VictorEijkhout–T
E
XbyTopic
77