How to format paragraph string to show content left, Right or middle of pdf document using iTextsharp ' vb

Dear All
how to format paragraph string to show content left, Right or middle of pdf document using iTextsharp in visual basic and absolute position on the document.
Thanks

 Here is one more example that i have modified the GetCell function so that you can use it for adding all the cells to the document.  It takes several arguments to specify everything you need to create each cell.  It now lets
you specify the Text, the Text Alignment, the Text Font and color, weather the cell shows the Border, the BackColor of the cell, and the Padding values for the Left, Right, Top, and Bottom.
 If you study the code you should be able to figure out how it works.  From here you can figure out the rest of what you need to do and how to use the
GetCell function.
 With one quick google search for "iTextSharp Documentation" the first link to pop up was this link.
iTextSharp Documentation
Imports System.IO
Imports Its = iTextSharp.text
Public Class Form1
Private dt As New DataTable
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
dt.Dispose()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dt.Columns.Add("Name")
dt.Columns.Add("Age")
dt.Columns.Add("Birth Date")
dt.Rows.Add(New Object() {"Johnny", "23", Now.AddYears(-23).ToString})
dt.Rows.Add(New Object() {"Frank", "41", Now.AddYears(-41).ToString})
dt.Rows.Add(New Object() {"Rex", "33", Now.AddYears(-33).ToString})
dt.Rows.Add(New Object() {"Kim", "26", Now.AddYears(-26).ToString})
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyPdfFilePath As String = "C:\TestFolder\MyPdf.pdf"
Dim pSize As New Its.Rectangle(Its.PageSize.A4)
Dim PdfDoc As Its.Document = New Its.Document(pSize, 10, 10, 10, 10)
Dim PdfImage As New Its.Jpeg(New Uri("C:\TestFolder\MyLogo.jpg"))
PdfImage.Alignment = Its.Jpeg.ALIGN_CENTER
Dim pTable As New Its.pdf.PdfPTable(1)
pTable.AddCell(getCell("Name : " & TextBox1.Text, Its.pdf.PdfPCell.ALIGN_CENTER, Its.FontFactory.GetFont("Arial", 15, Its.BaseColor.BLACK), False, Its.BaseColor.WHITE, 10, 0, 0, 0))
pTable.AddCell(getCell("Policy : " & TextBox2.Text, Its.pdf.PdfPCell.ALIGN_CENTER, Its.FontFactory.GetFont("Arial", 20, Its.BaseColor.RED), False, Its.BaseColor.WHITE, 10, 20, 0, 0))
Dim cTable As New Its.pdf.PdfPTable(dt.Columns.Count)
For Each col As DataColumn In dt.Columns
cTable.AddCell(getCell(col.ColumnName, Its.pdf.PdfPCell.ALIGN_CENTER, Its.FontFactory.GetFont("Arial", 12, Its.BaseColor.WHITE), True, Its.BaseColor.BLUE, 3, 5, 0, 0))
Next
Dim tblfont As Its.Font = Its.FontFactory.GetFont("Arial", 10, Its.BaseColor.BLACK)
For Each row As DataRow In dt.Rows
cTable.AddCell(getCell(row.Field(Of String)("Name"), Its.pdf.PdfPCell.ALIGN_LEFT, tblfont, True, Its.BaseColor.WHITE, 3, 4, 3, 0))
cTable.AddCell(getCell(row.Field(Of String)("Age"), Its.pdf.PdfPCell.ALIGN_CENTER, tblfont, True, Its.BaseColor.WHITE, 3, 4, 0, 0))
cTable.AddCell(getCell(row.Field(Of String)("Birth Date"), Its.pdf.PdfPCell.ALIGN_RIGHT, tblfont, True, Its.BaseColor.WHITE, 3, 4, 0, 3))
Next
Using fs As New FileStream(MyPdfFilePath, FileMode.Create, FileAccess.Write, FileShare.None)
Using pdfWrite As Its.pdf.PdfWriter = Its.pdf.PdfWriter.GetInstance(PdfDoc, fs)
PdfDoc.Open()
PdfDoc.Add(PdfImage)
PdfDoc.Add(pTable)
PdfDoc.Add(cTable)
PdfDoc.Close()
End Using
End Using
PdfDoc.Dispose()
End Sub
''' <summary>Creates a new cell for the table.</summary>
''' <param name="text">The text string for the cell.</param>
''' <param name="alignment">Alighnment for the text string.</param>
''' <param name="textfont">The font used for the text string.</param>
''' <param name="border">True to show the cell border. False to hide the cell border.</param>
''' <param name="backcolor">The background color of the cell.</param>
''' <param name="padtop">The amount of padding on the top of the text string.</param>
''' <param name="padbottom">The amount of padding on the bottom of the text string.</param>
''' <param name="padleft">The amount of padding on the left of the text string.</param>
''' <param name="padright">The amount of padding on the right of the text string.</param>
Public Function getCell(ByVal text As String, ByVal alignment As Integer, ByVal textfont As Its.Font, ByVal border As Boolean, ByVal backcolor As Its.BaseColor, ByVal padtop As Single, ByVal padbottom As Single, ByVal padleft As Single, ByVal padright As Single) As Its.pdf.PdfPCell
Dim cell As New Its.pdf.PdfPCell(New Its.Phrase(text, textfont))
cell.BackgroundColor = backcolor
cell.PaddingLeft = padleft
cell.PaddingRight = padright
cell.PaddingTop = padtop
cell.PaddingBottom = padbottom
cell.HorizontalAlignment = alignment
If Not border Then cell.Border = Its.pdf.PdfPCell.NO_BORDER
Return cell
End Function
End Class
If you say it can`t be done then i`ll try it

Similar Messages

  • How to I set an internal link in a PDF document using Preview?  After setting a link under the Tools/Annotations menu, the link doesn't work and no detailed instructions are provided.

    How to I set an internal link in a PDF document using Preview?  After setting a link under the Tools/Annotations menu, the link doesn't work and no detailed instructions are provided via the Help menu other than it showing the pull-down menu selection to make.

    No.  I am able to use the other features such as underlining, highlighting, adding rectangles and oval and save those changes.

  • How can I see a list of all my comments for a certain PDF document on my iPad?

    how can I c a list of all of the comments in a PDF document in the acrobat app on my iPad?
    thanks,
    ori

    Hi Orirotlevy,
    Sorry but no such feature is available in Adobe Acrobat app for ipad.
    Moreover, You can provide your valuable suggestions for this app, using the following Link : https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    Regards,
    Rahul

  • Command to move content left/right in Smartform label for zebra printer

    Issue : Command to move print content left/right in Smartform label for zebra printer.
    Requirement : If you changed the printer setting top position and left position, Print should start from a specific (X,Y) position.
    I am facing an issue while printing a smartfroms in different zebra printer.  We had tried all
    S_LZPL_SETUP_X  (Where X is LH/SPD/MD/PM/FT )
    But these command are not working in smartforms.
    We had used ZPL II printer command like u2018LH X,Yu2019  and u2018FT,X,Yu2019  in main window as well as in subsequent windows. But that also not working.
    Please advice.
    dinesh.

    Hi,
    If you follow notes #750002 and #750772 and use a smartforms and device type LZEB2, then the you cn just adjust the position of the text in the smartform. e.g. Use tab-stops, spaces or adjust the position of the window. There is no need to use ZPL2 commands directly.
    Regards,
    Aidan

  • How to append the string into blob content

    the blob column will have a string with comma separated values which needs to be changed to column wise data and update it back with the existing BLOB content.
    string like:-'V,CTMF,1.0,M,ICD-9 to 10 CM,CODE_COMMENTS_UPLOAD,0,A,bsns,2012-04-01,Author,pa admin,Comment,50 Record Map,F,Vascular,C,M'
    after i got splitting the values to column wise:
    V
    CTMF
    1.0
    M
    ICD-9 to 10 CM
    CODE_COMMENTS_UPLOAD
    0
    A
    bsns
    2012-04-01
    Author
    pa admin
    Comment
    50 Record Map
    F
    Vascular
    C
    M
    finally i need the blob append data output look like below,please do the needful................
    blob_value
    V,CTMF,1.0,M,ICD-9 to 10 CM,CODE_COMMENTS_UPLOAD,0,A,bsns,2012-04-01,Author,pa admin,Comment,50 Record Map,F,Vascular,C,M
    V
    CTMF
    1.0
    M
    ICD-9 to 10 CM
    CODE_COMMENTS_UPLOAD
    0
    A
    bsns
    2012-04-01
    Author
    pa admin
    Comment
    50 Record Map
    F
    Vascular
    C
    M

    actually
    my blob column values is:
    V,CTMF,1.0,M,ICD-9 to 10 CM,CODE_COMMENTS_UPLOAD,0,A,bsns,2012-04-01,Author,pa admin,Comment,50 Record Map,F,Vascular,C,M
    splitting column wise data is:-**
    V
    CTMF
    1.0
    M
    ICD-9 to 10 CM
    CODE_COMMENTS_UPLOAD
    0
    A
    bsns
    2012-04-01
    Author
    pa admin
    Comment
    50 Record Map
    F
    Vascular
    C
    M
    now i am appending the string to blob content at the end of the line only like
    V,CTMF,1.0,M,ICD-9 to 10 CM,CODE_COMMENTS_UPLOAD,0,A,bsns,2012-04-01,Author,pa admin,Comment,50 Record Map,F,Vascular,C,MVCTMF1.0MICD-9 to 10 CMCODE_COMMENTS_UPLOAD0Absns2012-04-01Authorpa adminComment50 Record MapFVascularCM
    but my requirement is should be to append the column wise data to existing blob column as new line like:
    V,CTMF,1.0,M,ICD-9 to 10 CM,CODE_COMMENTS_UPLOAD,0,A,bsns,2012-04-01,Author,pa admin,Comment,50 Record Map,F,Vascular,C,M
    VCTMF1.0MICD-9 to 10 CMCODE_COMMENTS_UPLOAD0Absns2012-04-01Authorpa adminComment50 Record MapFVascularCM
    my procedure:
    create or replace
    PROCEDURE PR_TEST_BLOB2 IS
    RES_BLOB CLOB;
    DEST_BLOB BLOB;
    SRC_BLOB BLOB;
    CURSOR CUR_TEST_BLOB2 IS
    SELECT REGEXP_SUBSTR(STR, '[^,]+', 1, LEVEL) FROM (SELECT UTL_RAW.CAST_TO_VARCHAR2(BLOB_VALUE) STR FROM TEST_BLOB2 WHERE TEST_ID=10)
    CONNECT BY LEVEL <= LENGTH(STR) - LENGTH(REPLACE(STR,','))+1;
    BEGIN
    OPEN CUR_TEST_BLOB2;
    LOOP
    FETCH CUR_TEST_BLOB2 INTO RES_BLOB;
    EXIT WHEN CUR_TEST_BLOB2%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE(RES_BLOB);
    DEST_BLOB:=UTL_RAW.CAST_TO_RAW(RES_BLOB);--converting clob to blob;
    SELECT BLOB_VALUE INTO SRC_BLOB
    FROM TEST_BLOB2
    WHERE TEST_ID = 10 FOR UPDATE;
    --move the blob values to source file
    DBMS_LOB.APPEND(SRC_BLOB,DEST_BLOB);-- append the blob values
    COMMIT;
    END LOOP;
    CLOSE CUR_TEST_BLOB2;
    END;
    could you please help me.

  • How do you permanently disable Tool Pane from showing up every time you open a pdf document in Adobe Reader DC 2015?

    Just like 9.9/10 people out here in the real world, I use Adobe Reader to read pdf files and never (ever) use the Tool Pane for anything.
    How do I permanently disable it from showing up, instead of having to close it *each & every time* I open a pdf document? The majority of people don't want thins thing covering up the page they are trying to read.

    Okay, seems I've stumbled upon an ugly workaround but it works for me. I'm using Windows 8.1. Go to the install directory, i.e." C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroApp\ENU". Create a new subfolder (I used "Disabled"). Move 3 files from the "ENU" folder into the new "Disabled" folder: AppCenter_R.aapp & Home.aapp & Viewer.aapp. Open a PDF and no more Tool Pane! I originally moved just the "Viewer" file but if you clicked on "Home" or "Tools" on the toolbar you couldn't go back to the "Document." Moving all 3 files takes care of that issue. Like a lot of people I don't and won't ever use any of the tools. I just want a reader. Let me know if this works for you.

  • How can I make some restictions in a PDF document using Acrobat 9 pro?

    Hello, I am a teacher from Spain. I am creating a PDF from a power point presentation, using Adobe Acrobat 9 pro. I will copy it in a cd and give it to my students. I would like to add these restrictions:
    I would like to avoid that they can copy this document.
    I only want to allow them to print it once.
    Thank you

    You can prevent copying of content (text and images) by setting permissions on the PDF file using Acrobat (apply password security, leaving the document open password empty).
    It is not possible to limit the number of times a PDF file is printed, no matter what settings you use. Printing can be disabled completely, or restricted to low-resolution output, but that is all. Even if it were somehow possible to restrict how many times Reader or Acrobat was allowed to print, there is no way to stop someone changing the copy number in the operating system print dialog, as that is beyond the control of any installed program. A printable PDF file can also be printed to another PDF file (called refrying), which will remove any interactive restrictions on the original.
    Note that permissions security is only respected by Adobe software. Third-party applications will often ignore the restrictions and allow all operations. The only way to truly protect the file is to apply a security method which is only found in Adobe products (such as LiveCycle policies), which will as a side-effect prevent anyone from opening the file in a third-party application that might not respect the restrictions.

  • How do i un-edit a pdf document using my Samsung 10.1 tablet?

    How Undo a pdf document?

    Thank you for your response. Using Adobe reader I underline or highlight the answers to the Watchtower study edition down loaded from their web site www.JW.org . Sometimes the whole paragraph inadvertently gets highlighted and then I can't seem to undo it.
    Best Regards,
    RW Rose
    Courtland, CA
    Sent from Samsung tablet note 10.1 (2014 edition)

  • How to stream YouTube video in PDF document using ID 5.5?

    I'm using ID 5.5 and know how to insert a video into a document using the Media palette, "Insert video from URL" option. However, I need to stream a YouTube video in an interactive PDF document, and when I try to insert the link from YouTube into the "Insert Video from URL" box, ID doesn't recognize it. I assume this is because YouTube video links don't end with a typical video format file-name ending, such as ".mp4" or ".mov"
    Has anyone been able to stream a YouTube video into a document using ID 5.5? If so, how did you do it?
    Downloading the video and inserting it as a regular video file isn't an option because we need to keep the PDF file size down.
    Thanks much for any advice you may have!

    It can't be done. A YouTube video cannot be streamed in any digital publishing media—PDF, EPUB, or DPS.
    There are applications which claim to be able to convert a YouTube video into a real digital publishing format like H264-encoded MP4 (preferred), but you'll have to investigate those on your own.

  • How to add a image at the top of every pages of a pdf document

    Hi all,
    My problem is as follows. I have a .pdf document and I'm copying it to another and then I'm appending some new things to it. Now while adding new pdf contents I want an image to be added for every new pages added to the document. I tried using "document.getPageNumber()" here document is a Document object which is a part of "itext-1.3.1.jar". But "document.getPageNumber()" is returning 0 every time.
    If anyone has the solution please help me out.
    Regards,
    turja

    there is no cursor to be set, as you go adding
    something in the pdf document those get added to that
    document and if one page gets filled it adds new page
    to it.If it says "current" page, then this implies that something is current with regards to something else. I'd like to know what "something else" is.

  • How to extract inline styles from a PDF document using Acrobat 9?

    I have a requirement for extracting all the contents along with the para level and character level styles from a PDF document in the form of XML. While doing so I'm getting lot of additional tags. In addition to that I'm not able to find the inline tags (character level tags) like bold, italics, superscripts etc and the page numbers. It would of great help if someone can throw light on this.
    Thanks.

    Moved to Acrobat Forum.

  • How do I convert a Word hyperlink path to point to a converted PDF document?

    I have a folder with Word documents that I want to convert to PDF. Many of the Word documents have hyperlinks to bookmarks in other Word documents in the same folder. (I'm trying to convert all the Word documents in the folder to PDF.) After I convert all the folder documents to PDF and click on the hyperlinks, they take me to the old Word documents. Is there a way to convert the hyperlink paths to instead take me to the converted PDF document?

    The original Hyperlink path, established in the MS Word files has as the target file some *.doc file.
    Edit Hyperlinks, in MS Word, to change the target file(s) to the appropriate *.pdf file.
    As a guess, I'd say someone familiar with MS VB might be able to come of with something to do the change programmatically.
    An alternative could be a web search for a possible Acrobat JavaScript that might do the job to the PDF files.
    Failing that the job would be done manually to each Hyperlink in each MS Word file.
    As to MS Hyperlinks to MS "Bookmarks" in other files.
    The [ # ] character used as a parameter is not interpreted by Adobe Reader / Acrobat in the same manner as MS Office products.
    Consequently, in an output PDF, the link will only open the target file. Note that MS Bookmarks within a DOC file will function in the output PDF.
    For PDF Open Parameters see:
    http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open _parameters_v9.pdf
    Be well...

  • How 2 search inside a PDF document using the firefox internal PDF reader

    Cannot find any way to do a text search inside a PDF document when it is displayed by the builtin PDF player in Firefox.
    If there is a way, how is it done?
    If there isn't a way, it seems an obvious enhancement.

    son of a gun. I've always searched in firefox by hitting slash and typing the search term, but that doesn't seem to work in the pdf reader. I guess, if I had searched for key bindings I coulda figured that out for myself.
    thanks!

  • The app? How do I open/create a new PDF document using Adope Reader

    How do I use the Adobe Reader app on my android tablet to create a PDF document.  Can the Reader app convert an existing *.docx document to a *.pdf?

    Currently this feature is not available in Adobe Reader.
    Thanks,
    -vaibhav

  • How to creating pdf documents using c# and Adobe SDK

    I downloaded Adobe SDK and go through the samples given in sdk. But i couldn't find any sample code how to create PDF file using C# code.
    Please, help me with this.
    Thanks.

    For desktop-based solutions, look at the Adobe Acrobat SDK which enables development around Acrobat itself. Or if you wish a stand-alone solution (for either desktop or server), we offer the Adobe PDFLibrary, which is the same technology used by all of Adobe's applications.
    For the server, we have our LiveCycle products including LC Generator.
    Leonard

Maybe you are looking for

  • Problem with report generation toolkit when installed new office 2010

    Dear all, I had  LabView 8.6.1 and report generation toolkit for MSoffice 2003 perfectly working in my laptop. Now I have added MSoffice 2010 and report generation toolkit does not work anymore since it is linked to new office. How can I inform Labvi

  • Contract price not taken in the SC

    Hi, We use contract management of the SRM EBP component.When creating SCs for internal Goods and service for a material on local contract (PCTR) we found the price picked is the valuation price maintained in the material master rather than picking up

  • InDesign Transparency Effect vs. pdf file size

    I have an Interactive pdf that was created from InDesign. There is  "inner glow" is an effect style created box style. This box style is used a number of times in the 30  page document. The glow is a gradient from black to transparent which looks  li

  • LIMIT Command through OLAP_TABLE

    Hi, I have a program within an AW that limits the dimensions to the values I am interested in. While acessing data from the AW through OLAP_TABLE, I call this program in the parameter that allows me one DML command. When the data is returned, I see t

  • Problem Accessing BI from VC

    Hi, We have installed Visual Composer and its latest Patch ie Patch 5. I have also installed the Add-Ons on our portal server whick is on SP12. In our landscape we have a BIW server. when we are trying to access this server through the menu options B