Endlich ist das neue Webdesign von www.tolpeit.it online.
Ich hoffe es gefällt euch!
Archiv für September 2010Neues WebdesignMittwoch, 29. September 2010Endlich ist das neue Webdesign von www.tolpeit.it online. Ich hoffe es gefällt euch! Itext merge pdfMontag, 20. September 2010Here is the code to merge a pdf file in C#. namespace MergePDF {
public class MergeEx {
#region Fields
private string sourcefolder;
private string destinationfile;
private IList fileList = new ArrayList();
#endregion
#region Public Methods
///
/// Add a new file, together with a given docname to
/// the fileList and namelist collection
///
///
public void AddFile(string pathnname) {
fileList.Add(pathnname);
}
///
/// Generate the merged PDF
///
public void Execute() {
MergeDocs();
}
#endregion
#region Private Methods
///
/// Merges the Docs and renders the destinationFile
///
///
private void MergeDocs() {
//Step 1: Create a Docuement-Object
Document document = new Document();
try {
//Step 2: we create a writer that listens to the document
PdfWriter writer = PdfWriter.GetInstance(document,
new FileStream(destinationfile, FileMode.Create));
//Step 3: Open the document
document.Open();
PdfContentByte cb = writer.DirectContent;
PdfImportedPage page;
int n = 0;
int rotation = 0;
//Loops for each file that has been listed
foreach (string filename in fileList) {
//The current file path
string filePath = sourcefolder + filename;
// we create a reader for the document
PdfReader reader = new PdfReader(filePath);
//Gets the number of pages to process
n = reader.NumberOfPages;
int i = 0;
while (i < n) {
i++;
document.SetPageSize(reader.GetPageSizeWithRotation(1));
document.NewPage();
//Insert to Destination on the first page
if (i == 1) {
Chunk fileRef = new Chunk(" ");
fileRef.SetLocalDestination(filename);
document.Add(fileRef);
}
page = writer.GetImportedPage(reader, i);
rotation = reader.GetPageRotation(i);
if (rotation == 90 || rotation == 270) {
cb.AddTemplate(page, 0, -1f, 1f, 0, 0, reader.GetPageSizeWithRotation(i).Height);
} else {
cb.AddTemplate(page, 1f, 0, 0, 1f, 0, 0);
}
}
}
} catch (Exception e) { throw e; } finally { document.Close(); }
}
#endregion
#region Properties
///
/// Gets or Sets the SourceFolder
///
public string SourceFolder {
get { return sourcefolder; }
set { sourcefolder = value; }
}
///
/// Gets or Sets the DestinationFile
///
public string DestinationFile {
get { return destinationfile; }
set { destinationfile = value; }
}
#endregion
}
}So you can call the merge function in the context. string sourcePath = @"D:\Pdf\";
MergeEx objMergeEx = new MergeEx();
objMergeEx.SourceFolder = sourcePath;
objMergeEx.DestinationFile = sourcePath + "Mergedfile.pdf";
objMergeEx.AddFile("parsetest.pdf");
objMergeEx.AddFile(@"regions\" + "eisacktal.pdf");
objMergeEx.Execute();download: itext Südtirol – Land der Berge 720pSamstag, 18. September 2010Hier eine eigen Produktion. Musik und Bilder von mir. httpvhd://www.youtube.com/watch?v=rhc1V4-tyXs&feature=player_embedded#! Convert MS SQL 2008 Database to MS SQL 2005Montag, 13. September 2010ProblemTransferring databases from SQL Server 2008 to SQL Server 2005 is not possible with standard backup and restore facilities. The solutionLeverage the scripting wizard in SQL Server 2008 to script data as well as schemas in SQL Server 2005 compatibility mode. Using the “Generate SQL Server Scripts” Wizard download here 211 MegaPixel Panorama – Seekofel 360°Freitag, 3. September 2010iText Html to Pdf ConverterFreitag, 3. September 2010iText ist eine OpenSource Projekt, welches ermöglicht nicht nur HTML in PDF zu konvertieren, sondern auch mittels Klassen ein beliebiges PDF zu erstellen. Man kann jedoch auch den umgekehrten Weg einschlagen und vom PDF ein HTML erstellen lassen. Leider gibt es viele verschiedene Versionen von iText, dadurch stimmen die meisten Tutorials nicht zusammen. Wenn man Zeit hat, ist es jedoch eine sehr gute Lösung. Hier zum download Hier ein kleines Tutorial von mir: Header und Footer einfügen in jede PDF-Seite: Um einen Footer oder Header einzufügen müsst ihr die Funktion OnEndPage() der Klasse PdfPageEventHelper überschreiben Dann müsst ihr noch das event euren PdfWriter hinzufügen
|