• Home
  • Referenzen
  • Südtirol Panorama
  • Impressum
  • Kontakt
  • Blog
  • Bilder Gallery
  • Artikel

    • Image Zoom mit Javascript
    • Windows Server 2008 mehrere RDP (Remote Dektop Verbindungen) zulassen
    • TR/Phorpiex 552960 Lösung
    • Facebook Connect via Asp.net
    • Samsung Wave S8500-S8530 Touchscreen/Display Tausch Anleitung
    • ERROR CREATING CONTROL FOR NODETYPE: Media Umbraco v4
    • Samsung Wave Bada 2.0 S8500XXKK5 zum download bereit
    • Funktionen und Views beim selbergenieren des LinqToSql Codes einbeziehen
    • Samsung Wave Google Exchange einrichten
    • Keep div:hover open when changing nested select box
    • Links

      • Flightplanning24 – Metar Taf Webcams
      • Internetseiten Südtirol
      • Jobbörse Südtirol
      • Niederkofler Webentwicklung
      • Snowtrex – Skiurlaub in Südtirol
  • Kategorien

    • Allgemein (23)
    • In eigener Sache (4)
    • Javascript (3)
    • Kaufberatung (2)
    • Konsolen (4)
    • Programmierung (9)
    • Spiele (7)
    • Technik (23)
    • Tools (6)
    • Webprogrammierung (78)
    • Windows (34)
      • Treiber (4)
    • XBox 360 (3)
  • Archive

    • Februar 2012
    • Januar 2012
    • Dezember 2011
    • November 2011
    • Oktober 2011
    • September 2011
    • August 2011
    • Juli 2011
    • Juni 2011
    • Mai 2011
    • April 2011
    • März 2011
    • Februar 2011
    • November 2010
    • Oktober 2010
    • September 2010
    • August 2010
    • Juli 2010
    • Juni 2010
    • Mai 2010
    • April 2010
    • März 2010
    • Februar 2010
    • Januar 2010
    • Dezember 2009
    • November 2009
    • Oktober 2009
    • September 2009

Archiv für September 2010

Neues Webdesign

Mittwoch, 29. September 2010

Endlich ist das neue Webdesign von www.tolpeit.it online.

Ich hoffe es gefällt euch!

Veröffentlicht in Webprogrammierung | Keine Kommentare »

Itext merge pdf

Montag, 20. September 2010

Here 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

Schlagworte:concat, Converter, itext, merge, pdf
Veröffentlicht in Programmierung, Webprogrammierung | 1 Kommentar »

Südtirol – Land der Berge 720p

Samstag, 18. September 2010

Hier eine eigen Produktion. Musik und Bilder von mir.

httpvhd://www.youtube.com/watch?v=rhc1V4-tyXs&feature=player_embedded#!

Schlagworte:Berge, Land, Natur, Südtirol, Urlaub
Veröffentlicht in Allgemein, In eigener Sache | Keine Kommentare »

Convert MS SQL 2008 Database to MS SQL 2005

Montag, 13. September 2010

Problem

Transferring databases from SQL Server 2008 to SQL Server 2005 is not possible with standard backup and restore facilities.

The solution

Leverage 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
The Northwind database is no longer shipped as part of the SQL Server installation, but you can download it from go.microsoft.com. The data is scripted as INSERT statements.
To create the scripts, you have to run the “Generate SQL Server Scripts” wizard, which you can run within SQL Server Management Studio (once Object Explorer is connected to the appropriate instance) by right clicking on the database and selecting “Tasks –> Generate Scripts.”

download here

Schlagworte:2005, convert, Microsoft, sql server 2008
Veröffentlicht in Webprogrammierung, Windows | Keine Kommentare »

211 MegaPixel Panorama – Seekofel 360°

Freitag, 3. September 2010

Schlagworte:Panormafotos, Südtirol
Veröffentlicht in In eigener Sache | Keine Kommentare »

iText Html to Pdf Converter

Freitag, 3. September 2010

iText 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

  public class _events : PdfPageEventHelper {         private Image _img;         private Image _footerImg;         public _events() {             _img = Image.GetInstance(@"\logo_de.jpg");             _footerImg = Image.GetInstance(@"\footer_de.png");             /*             * scale image to fit available space, if needed             */             //_img.ScalePercent(50);         }         // Definition vom Header und Footer         public override void OnEndPage(PdfWriter writer, Document document) {             //document.Add(new Phrase("test"));             Rectangle page = document.PageSize;             // create two column table;             //=====  HEADER             PdfPTable head = new PdfPTable(1);             head.TotalWidth = page.Width;              //add image; PdfPCell() overload sizes image to fit cell             PdfPCell c;// = new PdfPCell(_img, false);             c = new PdfPCell(_img, false);             c.VerticalAlignment = Element.ALIGN_TOP;             c.HorizontalAlignment = Element.ALIGN_RIGHT;             c.Border = Rectangle.NO_BORDER;             head.AddCell(c);             head.WriteSelectedRows(                 0, -1, // first/last row; -1 flags all write all rows                 0, // left offset                 // ** bottom** yPos of the table                 page.Height ,               writer.DirectContent             );             //====== FOOTER ===========================================             PdfPTable footer = new PdfPTable(1);             footer.TotalWidth = page.Width;             //add the collection to the document             // header text             c = new PdfPCell(_footerImg);             c.Border = Rectangle.NO_BORDER;             c.VerticalAlignment = Element.ALIGN_BOTTOM;             c.HorizontalAlignment = Element.ALIGN_CENTER;             footer.AddCell(c);             footer.WriteSelectedRows(               0, -1,          // first/last row; -1 flags all write all rows               0,                 footer.TotalHeight + 15,               writer.DirectContent             );         }  public void GeneratePDF(){             //create document          //   Response.Write(Server.MapPath("."));        �             try {                 Document document = new Document(PageSize.A4,40,40,120,50);                 //writer - have our own path!!!                  PdfWriter writer = PdfWriter.GetInstance(document, >new FileStream(@"D:\Projekte\Portale\Suedtirolcom\suedtirolcom\Pdf\" + "parsetest.pdf", FileMode.Create));                     // the object required to write to a (output) Stream                     //PdfWriter.GetInstance(document, ms);                     _events e = new _events();                     // INSTEAD DO THIS TO SAVE IN-MEMORY COPY                     //PdfWriter writer = PdfWriter.GetInstance(document,  Response.OutputStream);                     writer.PageEvent = e;                     document.Open(); //document.close(); . . . }

Veröffentlicht in Webprogrammierung | 2 Kommentare »

designed by tolpeit © 2010 - all rights reserved