mvc open pdf file in new window : Convert pdf to word for editing text control Library platform web page .net azure web browser msmanual1-part1863

xmlpdfusermanualpage6of101
XMLPDF5.5.7ProgrammersGuide
November2006
4:Usage
templateDocisaSystem.Xml.XmlDocumentobject.
pdfStreamisthenameofthestreamwherethePDFfilewillbewritten. The
PDFiswrittentothestreamatitscurrentposition. Thestreamisnotclosed.
Use this callifyouarealreadycreatingyourXML usinganXmlDocument
object.
4.3.4
XML File to PDF Stream
public voidgenerate(StringtemplateFileName,System.IO.StreampdfStream)
templateFileNameisthenameofthefileondiskwhichcontainsthetemplate
XML.
pdfStreamisthenameofthestreamwherethePDFfilewillbewritten. The
PDFiswrittentothe streamatitscurrentposition. Thestreamisnotclosed.
Use thismethod to generate a PDF document to a stream,from from an XML
template without merging data. The stream can be valid stream including a
MemoryStreamorResponse.OutputStream.
4.3.5
XML File to PDF Stream, Data in String
public void generate( String templateFileName, System.IO.Stream pdfStream,
Stringdata)
templateFileNameisthenameofthefileondiskwhichcontainsthetemplate
XML.
pdfStreamisthenameofthestreamwherethePDFfilewillbewritten. The
PDFiswrittentothe streamatitscurrentposition. Thestreamisnotclosed.
dataisastringcontainingtheXMLdataelementstobemergedintothetemplate
XML.
Use thismethod to generate a PDF documentto a stream, readingthe template
from disk and merging data from memory. The stream can be valid stream
includingaMemoryStreamorResponse.OutputStream.
4.3.6
XML Stream to PDF Stream
public void generate( System.IO.Stream templateStream, System.IO.Stream
pdfStream)
templateStreamisastreamwhichcontainstheXMLtemplate.
pdfStreamisthenameofthestreamwherethePDFfilewillbewritten. The
PDFiswrittentothe streamatitscurrentposition. Thestreamisnotclosed.
Use thismethod to generate a PDF documentto a stream, readingthe template
XMLfrom another stream. The output stream can be valid streamincluding a
MemoryStreamorResponse.OutputStream.
Thismethod allows youto create the template XMLin memoryand not have to
save ittofilefirst.
Asanaside,tocreateaStreamofXMLinmemoryyoucanuse codelikethis:
Dim Xml As New StringBuilder()
Xml.Append("<document><block>")
Xml.Append("Hello World")
Xml.Append("</block></document>")
Dim stream As New MemoryStream( ASCIIEncoding.ASCII.GetBytes(
Xml.ToString() ) )
www.xmlpdf.com
Convert pdf to word for editing text - control Library platform:C# PDF Convert to Text SDK: Convert PDF to txt files in C#.net, ASP.NET MVC, WinForms, WPF application
C# PDF to Text (TXT) Converting Library to Convert PDF to Text
www.rasteredge.com
Convert pdf to word for editing text - control Library platform:VB.NET PDF Convert to Text SDK: Convert PDF to txt files in vb.net, ASP.NET MVC, WinForms, WPF application
VB.NET Guide and Sample Codes to Convert PDF to Text in .NET Project
www.rasteredge.com
xmlpdfusermanualpage7of101
XMLPDF5.5.7ProgrammersGuide
November2006
4:Usage
4.3.7
XML Stream to PDF Stream, Data in String
public void generate( System.IO.Stream templateStream, System.IO.Stream
pdfStream,Stringdata)
templateStreamisastreamwhichcontainstheXMLtemplate.
pdfStreamisthenameofthestreamwherethePDFfilewillbewritten. The
PDFiswrittentothe streamatitscurrentposition. Thestreamisnotclosed.
dataisastringcontainingtheXMLdataelementstobemergedintothetemplate
XML.
Use thismethod to generate a PDF documentto a stream, readingthe template
XMLfromanotherstreamwhile merging data froma string The output stream
canbevalidstreamincludingaMemoryStreamorResponse.OutputStream.
Thismethod allows youto create the template XMLin memoryand not have to
save ittofilefirst.
4.3.8
Retrieving count of pages created
public intgetPagesCreated()
Thismethodreturnsthenumberof physical pagescreatedinthePDFdocument.
Itshould onlybe called afteroneofthegenerate()methodsdescribedabove has
beencalled.
4.4
XML Validation
To use a DTD for validating the XMLyou must explictly enable validation for
each document. This is done by setting the ValidationType property on the
document to one of the values in the System.Xml.ValidationType enumeration,
forexample:
PDFDocument doc = new PDFDocument();
doc.ValidationType
= System.Xml.ValidationType.DTD;
ThedefaultvalueisSystem.Xml.None,inwhichcase novalidationisdone.
4.5
Versions
Pressing control-D in the Acrobat Reader displays the Document Summary
dialogbox. The ProducervalueindicatestheversionofXMLPDFusedtocreate
thePDFfile. Thiswillbe areleasenumbersuchas1.1.5plusthe letterJforthe
Java versionofXMLPDForMforthe.NETversion.
4.6
License File
Non-evaluation versions ofXMLPDFrequire a license file to run. Thisfile is
distributedtoalllicensedusersandmustbe placedinalocation where XMLPDF
can open the file. For most applicationsplacing the file in the directory from
whichthe applicationisstartedisallthatisrequired.
Ifthe license file isnotfoundbydefault,totell XMLPDFwhere the license file
is located you can set a property on the xmlpdf.licensing.Generator object as
shownhere.
PDFDocument doc = new PDFDocument();
xmlpdf.licensing.Generator.LicenseFileLocation
= @"d:\xmlpdf\testlic\xmlpdf.lic";
Where "d:\xmlpdf\testlic\xmlpdf.lic" should be changed to the location of the
licensefileonyoursystem.
www.xmlpdf.com
control Library platform:C# HTML5 PDF Viewer SDK to view, annotate, create and convert PDF
multiple file formats or export PDF to Word, Tiff and RasterEdge provide HTML5 PDF Viewer and Editor to help C# users to view, annotate, convert and edit
www.rasteredge.com
control Library platform:VB.NET PDF Convert to Word SDK: Convert PDF to Word library in vb.
Why do we need to convert PDF to Word file in VB.NET class PDF to Word conversion lies in the fact that compared to PDF document format, Word file is
www.rasteredge.com
xmlpdfusermanualpage8of101
XMLPDF5.5.7ProgrammersGuide
November2006
4:Usage
Doingthisoverridesthedefaultfile location. Wesuggest thatyourprogramload
the actual location from a configuration file or the registry to make you
application more flexible. We have not configured a registry setting because
some userswill runXMLPDFunderthe ASPNETaccountwhichbydefaultdoes
nothave registryaccess.
www.xmlpdf.com
control Library platform:VB.NET PDF: Basic SDK Concept of XDoc.PDF
VB.NET programmers can convert Word, Excel, PowerPoint Tiff, Jpeg Conversely, conversion from PDF to Word (.docx) and paste, cut, rotate, and save PDF page(s
www.rasteredge.com
control Library platform:How to C#: Basic SDK Concept of XDoc.PDF for .NET
C# programmers can convert Word, Excel, PowerPoint Tiff, Jpeg, Bmp Conversely, conversion from PDF to Word (.docx) and paste, cut, rotate, and save PDF page(s
www.rasteredge.com
xmlpdfusermanualpage9of101
XMLPDF5.5.7ProgrammersGuide
November2006
5:C# Example
CHAPTER 5
C# Example
5.1
C# Code
Asimple C# program for calling the XMLPDF library to create the PDF file
lookslike this:
using System;
using xmlpdf;
public class Create {
public static void main( string[] args ) {
PDFDocument doc = new PDFDocument();
doc.generate( args[0], args[1] );
}
}
Thisprogramtakesascommandline argumentstwofilenames,firstthename of
the XMLfile andthenthenameofthePDFfile.
Thisprogramisexecutedwithacommandsuchas:
CreateHelloWorld.xmlHelloWorld.pdf
Assuming the system is installed correctly this will create the file
HelloWorld.pdf.
5.2
Step by Step
Thestepsinvolvedincreatingtheabove programare shownhere:
1StartVisualStudio.NET
2Create anewproject
SelectFile|New|Projectfromthemenutobringupthe NewProjectdialog:
www.xmlpdf.com
control Library platform:C# TIFF: TIFF Editor SDK to Read & Manipulate TIFF File Using C#.
Convert Tiff file to bmp, gif, png, jpeg, and scanned PDF with high fidelity in C#. 2. Render text to text, PDF, or Word file. Tiff Metadata Editing in C#.
www.rasteredge.com
control Library platform:VB.NET PDF Library SDK to view, edit, convert, process PDF file
Able to render and convert PDF document to/from to integrate and perform PDF text extraction feature in offers robust APIs for editing PDF document hyperlink
www.rasteredge.com
xmlpdfusermanualpage10of101
XMLPDF5.5.7ProgrammersGuide
November2006
5:C# Example
In the Templates box select 'ConsoleApplication',enter 'TextXMLPDF'in the
Name text box, and enter a suitable directory in the Location text box. This
shouldlooklikethis:
PressOKtocreatethe project.
3ReferencetheXMLPDFDLL
Inthe SolutionExplorerwindowright clickonthe Referencesbranchandselect
'AddReference'. ThisbringsuptheAddReferencedialog:
ClickonBrowse andnavigatetothexmlpdf.dll.
ClickOK.
The SolutionExplorershould nowshowa reference from the new project tothe
XMLPDFDLL,likethis:
4AddtheCode
Paste the following code into the Class1.cs file which was created when the
projectwascreated. Replaceallofthecodeinthe file.
www.xmlpdf.com
control Library platform:VB.NET PDF Converter Library SDK to convert PDF to other file
MS Word 2003, 2007 and above versions are supported For how to convert PDF to HTML document in VB.NET application, a simple and easy VB Conversion of PDF to Text.
www.rasteredge.com
control Library platform:VB.NET PDF File Merge Library: Merge, append PDF files in vb.net
Merge Microsoft Office Word, Excel and PowerPoint data to PDF form. mature library SDK which adds powerful Portable Document Format (PDF) editing solutions and
www.rasteredge.com
xmlpdfusermanualpage11of101
XMLPDF5.5.7ProgrammersGuide
November2006
5:C# Example
using System;
using xmlpdf;
public class Create {
public static void main( string[] args ) {
PDFDocument doc = new PDFDocument();
doc.generate( args[0], args[1] );
}
}
5Compile
SelectBuild|BuildSolutionfromthemenutocompiletheproject
6Run
Either configure the command-line arguments using the Project | Properties
dialogorexecutetheprogramfromthecommandlinelikethis:
testxmlpdf helloworld.xml helloworld.pdf
Thiswillcreatethefilehelloworld.pdf
www.xmlpdf.com
control Library platform:C# PDF url edit Library: insert, remove PDF links in C#.net, ASP.
Free online C# class source code for editing PDF hyperlink in Visual Studio .NET Keep Microsoft Office Word, Excel and PowerPoint links in PDF document.
www.rasteredge.com
control Library platform:VB.NET TIFF: Read, Edit & Process TIFF with VB.NET Image Document
Windows and mobile viewers establishing; text & graphics Started with VB.NET TIFF Editing, VB.NET powerful & profession imaging controls, PDF document, image to
www.rasteredge.com
xmlpdfusermanualpage12of101
XMLPDF5.5.7ProgrammersGuide
November2006
6:Visual Basic Example
CHAPTER 6
Visual Basic Example
Asimple VB program for calling the XMLPDF library to create the PDF file
lookslike this:
Imports System
Imports xmlpdf
Module Module1
Sub Main()
Dim doc As New PDFDocument()
Dim args() As String =
Command().Split(" ".ToCharArray)
doc.generate(args(0), args(1))
End Sub
End Module
Thisprogramtakesascommandline argumentstwofilenames,firstthename of
the XMLfile andthenthenameofthePDFfile.
Thisprogramisexecutedwithacommandsuchas:
CreateHelloWorld.xmlHelloWorld.pdf
Assuming the system is installed correctly this will create the file
HelloWorld.pdf.
Thestepsinvolvedincreatingtheabove programare shownhere:
1StartVisualStudio.NET
2Create anewproject
SelectFile|New|Projectfromthemenutobringupthe NewProjectdialog:
In the Templates box select 'ConsoleApplication',enter 'TextXMLPDF'in the
Name text box, and enter a suitable directory in the Location text box. This
shouldlooklikethis:
www.xmlpdf.com
xmlpdfusermanualpage13of101
XMLPDF5.5.7ProgrammersGuide
November2006
6:Visual Basic Example
PressOKtocreatethe project.
3ReferencetheXMLPDFDLL
Inthe SolutionExplorerwindowright clickonthe Referencesbranchandselect
'AddReference'. ThisbringsuptheAddReferencedialog:
ClickonBrowse andnavigatetothexmlpdf.dll.
ClickOK.
The SolutionExplorershould nowshowa reference from the new project tothe
XMLPDFDLL,likethis:
4AddtheCode
Paste the following code into the Module1.vb file which wascreated when the
projectwascreated. Replaceallofthecodeinthe file.
www.xmlpdf.com
xmlpdfusermanualpage14of101
XMLPDF5.5.7ProgrammersGuide
November2006
6:Visual Basic Example
Imports System
Imports xmlpdf
Module Module1
Sub Main()
Dim doc As New PDFDocument()
Dim args() As String =
Command().Split(" ".ToCharArray)
doc.generate(args(0), args(1))
End Sub
End Module
5Compile
SelectBuild|BuildSolutionfromthemenutocompiletheproject
6Run
Either configure the command-line arguments using the Project | Properties
dialogorexecutetheprogramfromthecommandlinelikethis:
vbconsole helloworld.xml helloworld.pdf
Thiswillcreatethefilehelloworld.pdf
www.xmlpdf.com
xmlpdfusermanualpage15of101
XMLPDF5.5.7ProgrammersGuide
November2006
7:ASP.NET Example
CHAPTER 7
ASP.NET Example
The followingisthe code fora webpage which willreadthefile 'hello.xml'and
returnthePDFfile tothebrowser.
<%@ Page Language="C#"%>
<%@ Import NameSpace='System.IO' %>
<%@ Import NameSpace='System.Net' %>
<%@ Import NameSpace='xmlpdf' %>
<%
PDFDocument doc = new PDFDocument();
Response.Clear();
Response.ContentType = "application/pdf";
string template = @"d:\xmlpdf\hello.xml";
MemoryStream memory = new MemoryStream();
doc.generate( template, memory );
Response.AddHeader( "content-length",
System.Convert.ToString( memory.Length ) );
Response.BinaryWrite( memory.ToArray() );
Response.Flush();
Response.End();
%>
Thefollowingare thekeythingstonoteinthiscode:
Response.ContentTypesetstheMIMEtypeofthecontentsothebrowserknows
tostartAcrobattohandlethe returnedfile.
The PDF is generated into a System.IO.MemoryStream object on the server.
This is done so that we can obtain the number of bytes to be returned to the
client. Thisisused whenwe callResponse.AddHeadertoset the lengthofthe
content.
Response.BinaryWrite()copiesthePDFbytestotheclientbrowser.
While it is possible to pass the Response.OutputStream object directly to the
generate call(asthe secondparameter)thisisnotreliablewhenthe PDFfile size
isverysmall.
www.xmlpdf.com
Documents you may be interested
Documents you may be interested