本文整理汇总了C#中Aspose.Pdf.Generator.Pdf类的典型用法代码示例。如果您正苦于以下问题:C# Aspose.Pdf.Generator.Pdf类的具体用法?C# Aspose.Pdf.Generator.Pdf怎么用?C# Aspose.Pdf.Generator.Pdf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Aspose.Pdf.Generator.Pdf类属于命名空间,在下文中一共展示了Aspose.Pdf.Generator.Pdf类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Run
public static void Run()
{
try
{
// ExStart:HyperlinkTags
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();
// Instantiate a pdf document
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Create a section in the pdf document
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
// Create a string variable with text containing hyperlink tag
string string1 = "<a href=\"http:// Www.aspose.com/\">This is a test</a>";
// Create text paragraph containing HTML hyperlink tag
Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(string1);
text1.IsHtmlTagSupported = true;
// Add the text paragraph containing HTML text to the section
sec1.Paragraphs.Add(text1);
// Save the document
pdf1.Save(dataDir + "HyperlinkTags_out.pdf");
// ExEnd:HyperlinkTags
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:33,代码来源:HyperlinkTags.cs
示例2: Run
public static void Run()
{
// ExStart:LoadDataInXMLTemplate
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_AdvanceFeatures();
// Creating a new Pdf object
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
// Binding the content from the named XML file
pdf.BindXML(dataDir + "Sample.xml", null);
// In a real scenario, data is usually input from Database. So, we can get data
// From a database. In this case, we are using a method that will provide us an
// Instance of DataTable. The implementation of this method is also given below.
DataTable getDT = creatDataTable();
// Accessing a table through its ID
Aspose.Pdf.Generator.Table contenTable = (Aspose.Pdf.Generator.Table)pdf.GetObjectByID("Content");
// Importing data from a DataTable and filling the table in PDF document
contenTable.ImportDataTable(getDT, false, 1, 1, 5, 4);
// Saving the results
pdf.Save(dataDir + "Sample_out.pdf");
// ExEnd:LoadDataInXMLTemplate
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:27,代码来源:LoadDataInXMLTemplate.cs
示例3: Main
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Path.GetFullPath("../../../Data/");
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiate Pdf object by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
//Create a section in the Pdf object
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
//Create a new text paragraph with an initial text segment "Aspose"
Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1,"Aspose");
//Add the text paragraph to the section
sec1.Paragraphs.Add(text1);
//Create a new text segment into the text paragraph
Aspose.Pdf.Generator.Segment seg2 = text1.Segments.Add("TM");
//Set the vertical alignment of text segment "seg2" to Topline by setting
//IsBaseline property ot seg2.TextInfo to true
seg2.TextInfo.IsBaseline=false;
// set the font size information for the segment
seg2.TextInfo.FontSize = 5;
//Save the Pdf
pdf1.Save(dataDir+ "AsposeOutput.pdf");
}
开发者ID:Ravivishnubhotla,项目名称:Aspose_Pdf_NET,代码行数:34,代码来源:Program.cs
示例4: Run
public static void Run()
{
// ExStart:AssignID
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Paragraphs();
// Instantiate Pdf object by calling its empty constructor and add a new section to the Pdf object
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
// Create a text paragraph with the reference of a section, sec1 and add the text paragraph in the section
Aspose.Pdf.Generator.Text text3 = new Aspose.Pdf.Generator.Text(sec1, "product 1 info ...");
sec1.Paragraphs.Add(text3);
// Set the text paragraph to be the first paragraph among the other ones
text3.IsFirstParagraph = true;
// Assign and ID to the text paragraph
text3.ID = "product1";
dataDir = dataDir + "AssignID_out.pdf";
// Save the resultant PDF
pdf1.Save(dataDir);
// ExEnd:AssignID
Console.WriteLine("\nAn id assigned successfully to a paragraph.\nFile saved at " + dataDir);
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:26,代码来源:AssignID.cs
示例5: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();
// Instantiate Pdf instance by calling it empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Create a section in the Pdf object
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
// ExStart:PFMFont
// Create a text object in a section
Aspose.Pdf.Generator.Text t1 = new Aspose.Pdf.Generator.Text(sec1, "Arial Bold MT");
// Set the font name of a segment in the text object
t1.Segments[0].TextInfo.FontName = "Arial-BoldMT";
// Set the PFM file for the text segment
t1.Segments[0].TextInfo.FontPfmFile = "_AB_____.PFM";
// Set the font encoding file for the text segment
t1.Segments[0].TextInfo.FontEncodingFile = @"CP1250.txt";
// Set the font encoding name of the text segment
t1.Segments[0].TextInfo.FontEncoding = "cp1250";
// ExEnd:PFMFont
dataDir = dataDir + "PFMFont_out.pdf";
// Create the result PDF Document
pdf1.Save(dataDir);
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:32,代码来源:PFMFont.cs
示例6: Run
public static void Run()
{
// ExStart:UserDefinedBullets
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Headings();
// Instntiate the Pdf object by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Create the section in the Pdf object
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
/*
* Create 1st heading in the Pdf object's section with level=1. Then create a text
* segment and add it in the heading. Set its UserLabel="98" to use a user defined
* bullet. You must set BulletFontName to "Symbol" or "ZapfDingbats". After setting
* all properties, add heading into the paragraphs collection of the section
*/
Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment(heading1);
heading1.Segments.Add(segment1);
segment1.Content = "Symbol";
heading1.BulletFontName = "Symbol";
heading1.UserLabel = "98";
sec1.Paragraphs.Add(heading1);
/*
* Create 2nd heading in the Pdf object's section with level=2. Then create a text
* segment and add it in the heading. Set its UserLabel="99" to use a user defined
* bullet. You must set BulletFontName to "Symbol" or "ZapfDingbats". After setting
* all properties, add heading into the paragraphs collection of the section
*/
Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 2);
Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
heading2.Segments.Add(segment2);
segment2.Content = "Symbol";
heading2.BulletFontName = "Symbol";
heading2.UserLabel = "99";
sec1.Paragraphs.Add(heading2);
/*
* Create 3rd heading in the Pdf object's section with level=3. Then create a text
* segment and add it in the heading. Set its UserLabel="100" to use a user defined
* bullet. You must set BulletFontName to "Symbol" or "ZapfDingbats". After setting
* all properties, add heading into the paragraphs collection of the section
*/
Aspose.Pdf.Generator.Heading heading3 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 3);
Aspose.Pdf.Generator.Segment segment3 = new Aspose.Pdf.Generator.Segment(heading3);
heading3.Segments.Add(segment3);
segment3.Content = "Symbol";
heading3.BulletFontName = "Symbol";
heading3.UserLabel = "100";
sec1.Paragraphs.Add(heading3);
pdf1.Save(dataDir + "UserDefinedBullets_out.pdf");
// ExEnd:UserDefinedBullets
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:60,代码来源:UserDefinedBullets.cs
示例7: Main
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Path.GetFullPath("../../../Data/");
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiate Pdf instance by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
//Create a section in the Pdf document
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
//Add a text paragraph in the section
sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text("page 1"));
//Create another text paragraph that has to be rendered
Aspose.Pdf.Generator.Text t2 = new Aspose.Pdf.Generator.Text("page2");
//Set the IsFirstParagraph property of the text paragraph to true
//to render it to a new page
t2.IsFirstParagraph = true;
//Add the text paragraph to be rendered to the section
sec1.Paragraphs.Add(t2);
//Save the Pdf document
pdf1.Save(dataDir+ "HelloWorld.pdf");
}
开发者ID:Ravivishnubhotla,项目名称:Aspose_Pdf_NET,代码行数:32,代码来源:Program.cs
示例8: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiate Pdf instance by calling it empty constructor
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
//Create a section in the Pdf object
pdf.Sections.Add();
pdf.IsTruetypeFontMapCached = true;
//Specify the location where to save TruetypeFontMap.xml
pdf.TruetypeFontMapPath = dataDir+ "" ;
//Create a text object and pass the string object carrying arabic text in it
Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text();
//Create a segment and add it to segments collection of text object
Aspose.Pdf.Generator.Segment seg0 = text1.Segments.Add();
//specify contents for segment
seg0.Content = "أسبوز هو بائع عنصر ال";
Aspose.Pdf.Generator.Segment seg1 = text1.Segments.Add();
seg1.Content = ".NET";
Aspose.Pdf.Generator.Segment seg2 = text1.Segments.Add();
seg2.Content = "البارز";
//Enable text alignment from right to left
seg0.TextInfo.IsRightToLeft = true;
seg1.TextInfo.IsRightToLeft = false; //default
seg2.TextInfo.IsRightToLeft = true;
//Enable unicode character set for the text segment
seg0.TextInfo.IsUnicode = true;
seg1.TextInfo.IsUnicode = true;
seg2.TextInfo.IsUnicode = true;
//Set Font Name
seg0.TextInfo.FontName = "Times New Roman";
seg1.TextInfo.FontName = "Times New Roman";
seg2.TextInfo.FontName = "Times New Roman";
//Set font size
seg0.TextInfo.FontSize = 14;
seg1.TextInfo.FontSize = 14;
seg2.TextInfo.FontSize = 14;
//Align text to right hand side using AlignmentType enumeration
//Make the text right aligned(The meaning of Alignment.Left and AlignmentType.Right are //exchanged when processing RTL language).
text1.TextInfo.Alignment = Aspose.Pdf.Generator.AlignmentType.Left;
pdf.Sections[0].Paragraphs.Add(text1);
pdf.IsRtlInSegmentMode = true; //default
pdf.Save(dataDir+"AsposeOutput.pdf");
}
开发者ID:joyang1,项目名称:Aspose_Pdf_NET,代码行数:60,代码来源:RTLLanguages.cs
示例9: Run
public static void Run()
{
try
{
// ExStart:CreatePdfA1
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_TechnicalArticles();
// Create pdf document
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Instantiate License class and call its SetLicense method to use the license
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense("Aspose.Custom.lic");
// Set the conformance property of Pdf class to predefined value
pdf1.Conformance = Aspose.Pdf.Generator.PdfConformance.PdfA1B;
// Add a section into the pdf document
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
// Save the document
pdf1.Save(dataDir + "CreatePdfA1_out.pdf");
// ExEnd:CreatePdfA1
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
}
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:30,代码来源:CreatePdfA1.cs
示例10: TrueTypeBoldFont
public static void TrueTypeBoldFont()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();
// Instantiate Pdf instance by calling it empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Create a section in the Pdf object
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
// ExStart:TrueTypeBoldFont
// Create a text object in the section
Aspose.Pdf.Generator.Text t1 = new Aspose.Pdf.Generator.Text(sec1, "Courier New Bold font");
// Set font name of a specific text segment to courier new
t1.Segments[0].TextInfo.FontName = "Courier New";
// Set the font to bold
t1.Segments[0].TextInfo.IsTrueTypeFontBold = true;
// ExEnd:TrueTypeBoldFont
dataDir = dataDir + "TrueTypeBoldFont_out.pdf";
// Create the result PDF Document
pdf1.Save(dataDir);
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:26,代码来源:EmbedFont.cs
示例11: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Sections();
// Instantiate a PDF Object
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
// Add a section into the pdf document
Aspose.Pdf.Generator.Section section1 = pdf.Sections.Add();
// ExStart:SetPageSize
section1.PageInfo.PageWidth = Aspose.Pdf.Generator.PageSize.A3Width;
section1.PageInfo.PageHeight = Aspose.Pdf.Generator.PageSize.A3Height;
// ExEnd:SetPageSize
// OR
// ExStart:SetPageSize-1
section1.PageInfo.PageWidth = 576;
section1.PageInfo.PageHeight = 707.5F;
// ExEnd:SetPageSize-1
dataDir = dataDir + "SetPageSize_out.pdf";
// Save Pdf Document
pdf.Save(dataDir);
Console.WriteLine("\nPage size setup successfully.\nFile saved at " + dataDir);
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:29,代码来源:SetPageSize.cs
示例12: Run
public static void Run()
{
// ExStart:CreatePdf
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();
// Create a file stream to create the PDF document
FileStream fs = new FileStream( dataDir + "SingleSeg-d_out.pdf", FileMode.Create);
// Instantiate the Pdf instance and pass the file stream object to its constructor
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf(fs);
// Add a section to the PDF document
Aspose.Pdf.Generator.Section sec1 = pdf.Sections.Add();
// Add 1000 text paragraphs to the section
for (int i = 0; i < 1000; i++)
{
Aspose.Pdf.Generator.Text t = new Aspose.Pdf.Generator.Text("hello world hello world hello " + i.ToString());
sec1.AddParagraph(t);
}
// Close the Pdf. This method is used only for direct file mode
pdf.Close();
// ExEnd:CreatePdf
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:26,代码来源:CreatePdf.cs
示例13: DefineFormat
public static void DefineFormat()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();
// Instantiate Pdf instance by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Create a list section
Aspose.Pdf.Generator.ListSection tocSection = new Aspose.Pdf.Generator.ListSection("Table Of Contents");
// Set its list type as table of of contents
tocSection.ListType = Aspose.Pdf.Generator.ListType.TableOfContents;
// ExStart:DefineFormat
// Set the length of list levels to 3 and set their left margins and text formats
tocSection.ListFormatArray.Length = 3;
tocSection.ListFormatArray[0].LeftMargin = 0;
tocSection.ListFormatArray[0].TextInfo.FontSize = 16;
tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontBold = true;
tocSection.ListFormatArray[1].LeftMargin = 16;
tocSection.ListFormatArray[1].TextInfo.FontSize = 14;
tocSection.ListFormatArray[2].LeftMargin = 32;
tocSection.ListFormatArray[2].TextInfo.FontSize = 12;
// ExEnd:DefineFormat
// Add the list section to the sections collection of the Pdf document
pdf1.Sections.Add(tocSection);
dataDir = dataDir + "DefineFormat_out.pdf";
// Save the Pdf
pdf1.Save(dataDir);
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:35,代码来源:AddingList.cs
示例14: FontsEmbeddingUsingHTML
public static void FontsEmbeddingUsingHTML()
{
// ExStart:FontsEmbeddingUsingHTML
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_TechnicalArticles();
// Instantiate a pdf document
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Create a section in the pdf document
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
// Create string variables with text containing html tags
string s = "<html><body><font isUnicode='true' face='Bete Noir NF' size=18><i>Sample text </i>with Custome font Embedded </font><br><font isUnicode='true' face='Courier New' size=10><s>Sample Text </s>in <u>Courier New</u> font</font></body></html>";
// Create text paragraphs containing HTML text
Aspose.Pdf.Generator.Text t1 = new Aspose.Pdf.Generator.Text(s);
// Enable the HTML tag support property
t1.IsHtmlTagSupported = true;
// Add the text paragraphs containing HTML text to the section
sec1.Paragraphs.Add(t1);
// Save the pdf document
pdf1.Save( dataDir + "inLineFormated_HtmlSuported_out.pdf");
// ExEnd:FontsEmbeddingUsingHTML
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:28,代码来源:FontsEmbedding+.cs
示例15: Main
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Path.GetFullPath("../../../Data/");
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiate a PDF Object
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
//Add a section into the pdf document
Aspose.Pdf.Generator.Section section1 = pdf.Sections.Add();
//Assign the image file path to BackgroundImageFile property of section
section1.BackgroundImageFile = dataDir+ "aspose-logo.jpg";
//Set the image type using ImageFileType enumeration
section1.BackgroundImageType = Aspose.Pdf.Generator.ImageFileType.Jpeg;
//Save Pdf Document
pdf.Save(dataDir+ "Aspose.pdf");
}
开发者ID:Ravivishnubhotla,项目名称:Aspose_Pdf_NET,代码行数:25,代码来源:Program.cs
示例16: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_WorkingDocuments();
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiate a PDF Object
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
//Instantiate a Aspose PDF JavaScript Object
pdf.JavaScripts = new Aspose.Pdf.Generator.JavaScripts();
//Call the Add method and pass JavaScript statement as an argument, to show Print Dialog
pdf.JavaScripts.Add("this.print(true);");
//Call the Add method and JavaScript statement as an argument, to show alert
pdf.JavaScripts.Add("app.alert(\"hello world\");");
//Save Pdf Document
pdf.Save(dataDir+ "Aspose.pdf");
}
开发者ID:joyang1,项目名称:Aspose_Pdf_NET,代码行数:27,代码来源:AddJavaScript.cs
示例17: Run
public static void Run()
{
// ExStart:SetEncryption
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_SecurityFeatures();
// Instantiate Pdf instance by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Assign a security instance to Pdf object
pdf1.Security = new Aspose.Pdf.Generator.Security();
// Set encryption level to 128 bits
pdf1.Security.Is128BitsEncrypted = true;
// Add a section in the Pdf
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
// Create a text paragraph
Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1,"this is text content");
// Set the top maring of text paragraph to 30
text1.Margin.Top = 30;
// Add the text paragraph to the section
sec1.Paragraphs.Add(text1);
dataDir = dataDir + "SetEncryption_out.pdf";
// Save the Pdf
pdf1.Save(dataDir);
// ExEnd:SetEncryption
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:32,代码来源:SetEncryption.cs
示例18: Run
public static void Run()
{
// ExStart:ReplaceableSymbols
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();
// Instantiate Pdf instance by calling it empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Create a section in the pdf object
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
// Create a HeaderFooter object for the section
Aspose.Pdf.Generator.HeaderFooter hf = new Aspose.Pdf.Generator.HeaderFooter(sec1);
// Set the HeaderFooter object to odd and even footers
sec1.OddFooter = sec1.EvenFooter = hf;
// Add a text paragraph containing current page number of total number of pages
hf.Paragraphs.Add(new Aspose.Pdf.Generator.Text(hf, "page $p of $P"));
dataDir = dataDir + "ReplaceableSymbols_out.pdf";
// Create the result PDF Document
pdf1.Save(dataDir);
// ExEnd:ReplaceableSymbols
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:26,代码来源:ReplaceableSymbols.cs
示例19: Main
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Path.GetFullPath("../../../Data/");
// Instantiate an object PDF class
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
// Read the contents of HTML file into StreamReader object
StreamReader r = File.OpenText(dataDir + "Aspose.htm");
//Create text paragraphs containing HTML text
Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());
// enable the property to display HTML contents within their own formatting
text2.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML text to the section
section.Paragraphs.Add(text2);
// Specify the URL which serves as images database
//pdf.HtmlInfo.ImgUrl = "D:/pdftest/MemoryStream/";
//Save the pdf document
pdf.Save(dataDir + "HTML2pdf.pdf");
}
开发者ID:Ravivishnubhotla,项目名称:Aspose_Pdf_NET,代码行数:29,代码来源:Program.cs
示例20: Run
public static void Run()
{
// ExStart:SetPassword
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_SecurityFeatures();
// Instantiate Pdf instance by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Assign a security instance to Pdf object
pdf1.Security = new Aspose.Pdf.Generator.Security();
// Set the master password for the PDF document
pdf1.Security.MasterPassword="master";
// Set the user password for the PDF document
pdf1.Security.UserPassword="user";
// Add a section in the Pdf
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
// Create a text paragraph
Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1,"this is text content");
// Set the top maring of text paragraph to 30
text1.Margin.Top = 30;
// Add the text paragraph to the section
sec1.Paragraphs.Add(text1);
dataDir = dataDir +"SetPassword_out.pdf";
// Save the Pdf
pdf1.Save(dataDir);
// ExEnd:SetPassword
}
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:34,代码来源:SetPassword.cs
注:本文中的Aspose.Pdf.Generator.Pdf类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论