How to write special characters in PDF using iText
How to write special characters encoded with UTF-8 in PDF using iText.
Regards,
Pandharinath.
I don't know what your problem is but that's almost certainly the wrong question to ask about it. Java (including iText) uses only Unicode characters. (You may consider some of them to be "special" if you like but Unicode doesn't.) And when it does that, they aren't encoded in UTF-8 or any other encoding.
So can you describe your problem? That question doesn't make sense.
Similar Messages
-
How to insert special characters in pdf comments
Now, we are ready to go "no paper" workflow, and so mark anything on pdf file, but we cannot insert most of special characters in PDF comments. Same as here, and the xml entity is "&PSgr;", "how to archive it?
>what the Character Map is?
You don't know how to use Google?
Character map is a standard part of Windows for using special
characters with any program.
In Windows XP, Start > All Programs > Accessories > System Tools >
Character Map.
Aandi Inston -
Write Special Characters in PDF file from SAP Script
Hi there,
Need a quick help...
We are converting SAP Script to PDF using the function module CONVERT_OTF
and saving the file on presentation server using GUI_DOWNLOAD...
But in certain cases where the item text is maintained with some special
characters like @#$% u03B1 u03B2 u03B3 u03B4 ®... then, some of these characters are seen
as junk/garbage characters...
how do we handle this??
P.S. Our Forms are already using Korean Font...
Any help is highly appreciated
Kind Regards,
TanujaHi,
Use the FM CONVERT_OTF to get the Binary data and down load it as PDF .
sample
*/ Convert the OTF data into PDF.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
importing
bin_filesize = lv_bin_filesize
bin_file = lv_xstring
tables
otf = lt_otf_data-otfdata[]
lines = lt_pdf_data
exceptions
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
others = 5 .
*/ Convert the Xstring data into PDF
call method cl_document_bcs=>xstring_to_solix
exporting
ip_xstring = lv_xstring
receiving
rt_solix = lt_mess_att .
Then down load the table lt_mess_att with extension PDF.
Edited by: UmaMaheswaraRao Surapaneni on Apr 1, 2009 5:44 PM -
How to print Special Characters in Sap-Scripts
How to print Special Characters in Sap-Scripts
Thanks,
RaviHi
if u want print special characters we can use hot codes i.e ' ' (single inverted commas). in between these hot codes insert u r special characters.
write ' !@#$%^&*( ) '.
for the above write statement output is
output is !@#$%^&*( ) -
How to export special characters into an XML file?
Dear experts,
We read files from our customers and save data into our customized table without any character changed, including some address fields. In those address fields, some special characters (not in our code page) are also kept. When we want to write these address fields into an XML file or flat file, the special charcters become "##" or not readable, can anyone help us to solve this issue?
Question1: How to write special code to an external file?
Question2: how to use 'CALL TRANSFORMATION' from an internal table to an XML file?
Your answer is highly appreciated!
JoanneHi Joanne.
Please check the below link.
CALL TRANSFORMATION
Before that u have to create one transformation program in STRANS tcode for using it in call transformation statement.
Hope it will be useful.
Regards,
Lakshman -
How to display special characters in Script...
hi all,
Can any one tell me how to display special characters in script...
how to write in text element
thanks in advance,
prashantHi Prashant ,
What special characters would you like to include .
There are a set of characters / icons /symbols that can be included in Script , for that open a window in edit mode and in the menu there will be an option called Insert , here you can find a lot of characters/symbols that can be included .
Regards,
Arun -
Can't show special characters (ÆØÅ) in pdf fields created with inDesign CS6
Hi Guys im having a problem with special characters in pdf's form fields created in inDesign CS6
instead of the character ÆØÅ it creates squares or some other seemingly random character
Here's the pdfI figured it out
Just in case people had the same problem here is how it's done: (i misunderstood the two posters above me, so you are actually going to change fonts within acrobat, like they said, and save it)
Open the pdf in acrobat, go and change font settings for each of your fields and change the font under the "Appearance" tab. -
How to write data to text file using external tables
can anybody tell how to write data to text file using external tables concept?
Hi,
Using external table u can load the data in your local table in database,
then using your local db table and UTL_FILE pacakge u can wrrite data to text file
external table
~~~~~~~~~~~
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2153251
UTL_FILE
~~~~~~~~~
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14093
Message was edited by:
Nicloei W
Message was edited by:
Nicloei W -
How do you setup to print PDFs using adobe?
How do you setup to print PDFs using adobe?
You install Adobe Acrobat, and 'Print to PDF' will be automatically set up.
-
How to write the data into EEPROM using Labview?
How to write the data into EEPROM using Labview?
You would need some sort of EEPROM programmer. Typically might
communicate with it via serial. I don't know how you would do this in
LV. You would need to have the command protocol for the programming
device to start with.
Doug De Clue
gpibssx wrote in message news:<[email protected]>...
> How to write the data into EEPROM using Labview? -
How to write code for font family using swing?
how to write code for font family using swing?
i tried this code.but i got only font styles.but i need font family.observ this code
import java.awt.*;
import java.awt.event.*;
public class fontSelect extends java.awt.Dialog implements AdjustmentListener, ItemListener, TextListener, ActionListener {
public Font selectedFont; //to get result
public boolean isSelected = false;
public Color selectedBackground, selectedForeground;
public fontSelect(Frame parent, boolean modal) {
super(parent, modal);
String fntName[] = getToolkit().getFontList();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] names = ge.getAvailableFontFamilyNames();
//{{INIT_CONTROLS
setLayout(null);
setVisible(false);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(insets().left + insets().right + 380,insets().top + insets().bottom + 282);
setBackground(java.awt.Color.lightGray);
fontList = new java.awt.Choice();
//fontList = new java.awt.List(0,false);
add(fontList);
fontList.setBounds(insets().left +25,insets().top + 50,137,144);
//label1 = new java.awt.Label("Example:-");
//label1.setBounds(insets().left + 220,insets().top + 36,84,30);
//add(label1);
exampleText = new java.awt.TextField();
//exampleText.setText("sample string ");
//exampleText.setBounds(insets().left + 40,insets().top + 50,84,21);
//add(exampleText);
label2 = new java.awt.Label("Font Family:-");
label2.setBounds(insets().left + 25,insets().top + 30,70,19);
add(label2);
isBold = new java.awt.Checkbox("Bold");
isBold.setBounds(insets().left + 320,insets().top + 90,60,18);
isBold.setFont(new Font("Times New Roman", Font.BOLD, 12));
add(isBold);
isItalic = new java.awt.Checkbox("Italic");
isItalic.setBounds(insets().left + 250,insets().top + 90,48,17);
isItalic.setFont(new Font("Times New Roman", Font.ITALIC, 12));
add(isItalic);
showFont = new java.awt.Label("samplestring ",Label.CENTER);
showFont.setBounds(insets().left + 240,insets().top +50,120,30);
showFont.setBackground(java.awt.Color.white);
add(showFont);
label11 = new java.awt.Label("Size:-");
label11.setBounds(insets().left + 290,insets().top + 120,70,19);
add(label11);
fontSize = new java.awt.Choice();
add(fontSize);
//label11 = new java.awt.Label("Example string");
fontSize.setBounds(insets().left + 290,insets().top + 140,60,23);
fontSize.setBackground(java.awt.Color.white);
btnSelect = new java.awt.Button();
btnSelect.setLabel("Select");
btnSelect.setBounds(insets().left + 280,insets().top + 190,87,24);
add(btnSelect);
btnCancel = new java.awt.Button();
btnCancel.setLabel("Cancel");
btnCancel.setBounds(insets().left + 280,insets().top + 230,91,24);
add(btnCancel);
label3 = new java.awt.Label("Background:-");
label3.setBounds(insets().left + 24,insets().top + 90,94,18);
add(label3);
rBackground = new java.awt.Scrollbar(Scrollbar.HORIZONTAL,255,0,0,255);
rBackground.setBounds(insets().left + 24,insets().top +110 ,197,21);
add(rBackground);
gBackground = new java.awt.Scrollbar(Scrollbar.HORIZONTAL,255,0,0,255);
gBackground.setBounds(insets().left + 24,insets().top + 135,197,21);
add(gBackground);
bBackground = new java.awt.Scrollbar(Scrollbar.HORIZONTAL,255,0,0,255);
bBackground.setBounds(insets().left + 24,insets().top + 160,197,21);
add(bBackground);
label4 = new java.awt.Label("R");
label4.setBounds(insets().left + 12,insets().top + 110,12,18);
label4.setFont(new Font("Times New Roman", Font.BOLD, 12));
label4.setForeground(java.awt.Color.red);
add(label4);
label5 = new java.awt.Label("G");
label5.setBounds(insets().left + 12,insets().top + 135,12,18);
label5.setFont(new Font("Times New Roman", Font.BOLD, 12));
label5.setForeground(new Color(-16744448));
add(label5);
label6 = new java.awt.Label("B");
label6.setBounds(insets().left + 12,insets().top + 160,12,18);
label6.setFont(new Font("Times New Roman", Font.BOLD, 12));
label6.setForeground(java.awt.Color.blue);
add(label6);
rBackValue = new java.awt.Label("255");
rBackValue.setBounds(insets().left + 225,insets().top + 110,24,12);
rBackValue.setFont(new Font("Times New Roman", Font.BOLD, 12));
rBackValue.setForeground(java.awt.Color.red);
add(rBackValue);
gBackValue = new java.awt.Label("255");
gBackValue.setBounds(insets().left + 225,insets().top + 135,24,12);
gBackValue.setFont(new Font("Times New Roman", Font.BOLD, 12));
gBackValue.setForeground(new Color(-16744384));
add(gBackValue);
bBackValue = new java.awt.Label("255");
bBackValue.setBounds(insets().left + 225,insets().top + 160,24,12);
bBackValue.setFont(new Font("Times New Roman", Font.BOLD, 12));
bBackValue.setForeground(java.awt.Color.blue);
add(bBackValue);
label7 = new java.awt.Label("Foreground:-");
label7.setBounds(insets().left + 20,insets().top + 185,94,18);
add(label7);
rForeground = new java.awt.Scrollbar(Scrollbar.HORIZONTAL,0,0,0,255);
rForeground.setBounds(insets().left + 20,insets().top + 205,197,21);
add(rForeground);
gForeground = new java.awt.Scrollbar(Scrollbar.HORIZONTAL,0,0,0,255);
gForeground.setBounds(insets().left + 20,insets().top + 230,197,21);
add(gForeground);
bForeground = new java.awt.Scrollbar(Scrollbar.HORIZONTAL,0,0,0,255);
bForeground.setBounds(insets().left + 20,insets().top + 255,197,21);
add(bForeground);
label8 = new java.awt.Label("R");
label8.setBounds(insets().left + 10,insets().top + 205,12,18);
label8.setFont(new Font("Times New Roman", Font.BOLD, 12));
label8.setForeground(java.awt.Color.red);
add(label8);
label9 = new java.awt.Label("G");
label9.setBounds(insets().left + 10,insets().top + 230,12,18);
label9.setFont(new Font("Times New Roman", Font.BOLD, 12));
label9.setForeground(new Color(-16744448));
add(label9);
label10 = new java.awt.Label("B");
label10.setBounds(insets().left + 10,insets().top + 255,12,18);
label10.setFont(new Font("Times New Roman", Font.BOLD, 12));
label10.setForeground(java.awt.Color.blue);
add(label10);
rForeValue = new java.awt.Label("255");
rForeValue.setBounds(insets().left + 220,insets().top + 205,24,12);
rForeValue.setFont(new Font("Times New Roman", Font.BOLD, 12));
rForeValue.setForeground(java.awt.Color.red);
add(rForeValue);
gForeValue = new java.awt.Label("255");
gForeValue.setBounds(insets().left + 220,insets().top + 230,24,12);
gForeValue.setFont(new Font("Times New Roman", Font.BOLD, 12));
gForeValue.setForeground(new Color(-16744384));
add(gForeValue);
bForeValue = new java.awt.Label("255");
bForeValue.setBounds(insets().left + 220,insets().top + 255,24,12);
bForeValue.setFont(new Font("Times New Roman", Font.BOLD, 12));
bForeValue.setForeground(java.awt.Color.blue);
add(bForeValue);
setTitle("Choosing font");
//{{REGISTER_LISTENERS
exampleText.addTextListener(this);
btnSelect.addActionListener(this);
btnCancel.addActionListener(this);
isBold.addItemListener(this);
fontList.addItemListener(this);
isItalic.addItemListener(this);
fontSize.addItemListener(this);
rBackground.addAdjustmentListener(this);
gBackground.addAdjustmentListener(this);
bBackground.addAdjustmentListener(this);
rForeground.addAdjustmentListener(this);
gForeground.addAdjustmentListener(this);
bForeground.addAdjustmentListener(this);
for (int i = 0; i < (int)fntName.length; i++)
fontList.addItem(fntName);
showFont.setFont(new Font(fntName[0], Font.PLAIN, 12));
// GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
//String[] names = ge.getAvailableFontFamilyNames();
for ( int i=0; i<names.length; i++ )
System.out.println( names[i] );
selectedBackground = showFont.getBackground();
selectedForeground = showFont.getForeground();
int i = 8;
do {
fontSize.addItem(""+i);
if (i<=30) i+=2;
else if (i<=70) i+=4;
else i+=8;
} while (i<150);
try {
fontSize.select(2);
} catch (IllegalArgumentException e) { }
//{{DECLARE_CONTROLS
//java.awt.List fontList;
java.awt.Label label11;
java.awt.Label label1;
java.awt.TextField exampleText;
java.awt.Label label2;
java.awt.Checkbox isBold;
java.awt.Checkbox isItalic;
java.awt.Label showFont;
java.awt.Choice fontSize;
java.awt.Choice fontList;
java.awt.Button btnSelect;
java.awt.Button btnCancel;
java.awt.Label label3;
java.awt.Scrollbar rBackground;
java.awt.Scrollbar gBackground;
java.awt.Scrollbar bBackground;
java.awt.Label label4;
java.awt.Label label5;
java.awt.Label label6;
java.awt.Label rBackValue;
java.awt.Label gBackValue;
java.awt.Label bBackValue;
java.awt.Label label7;
java.awt.Scrollbar rForeground;
java.awt.Scrollbar gForeground;
java.awt.Scrollbar bForeground;
java.awt.Label label8;
java.awt.Label label9;
java.awt.Label label10;
java.awt.Label rForeValue;
java.awt.Label gForeValue;
java.awt.Label bForeValue;
private Font constructFont() {
int l;
try {
l = Integer.parseInt(fontSize.getSelectedItem());
} catch (NumberFormatException e) {l = 12;}
selectedFont = new Font(fontList.getItem(fontList.getSelectedIndex()>=0?fontList.getSelectedIndex():0 ), (isBold.getState()?Font.BOLD:0)+(isItalic.getState()?Font.ITALIC:0), l);
selectedBackground = new Color(rBackground.getValue(), gBackground.getValue(), bBackground.getValue());
selectedForeground = new Color(rForeground.getValue(), gForeground.getValue(), bForeground.getValue());
return (selectedFont);
public void textValueChanged(java.awt.event.TextEvent event) {
Object object = event.getSource();
if (object == exampleText) showFont.setText(exampleText.getText());
public void actionPerformed(java.awt.event.ActionEvent event) {
Object object = event.getSource();
if (object == btnSelect) {
isSelected = true;
selectedFont = constructFont();
dispose();
} else if (object == btnCancel) {
selectedFont = null;
selectedBackground = null;
selectedForeground = null;
dispose();
public void itemStateChanged(java.awt.event.ItemEvent event) {
Object object = event.getSource();
if (object == isBold) showFont.setFont(constructFont());
else if (object == fontList) showFont.setFont(constructFont());
else if (object == isItalic) showFont.setFont(constructFont());
else if (object == fontSize) showFont.setFont(constructFont());
public void adjustmentValueChanged(java.awt.event.AdjustmentEvent event)
Object object = event.getSource();
constructFont();
showFont.setBackground(new Color(rBackground.getValue(), gBackground.getValue(), bBackground.getValue()));
showFont.setForeground(new Color(rForeground.getValue(), gForeground.getValue(), bForeground.getValue()));
if (object == rBackground) rBackValue.setText(""+rBackground.getValue());
else if (object == gBackground) gBackValue.setText(""+gBackground.getValue());
else if (object == bBackground) bBackValue.setText(""+bBackground.getValue());
else if (object == rForeground) rForeValue.setText(""+rForeground.getValue());
else if (object == gForeground) gForeValue.setText(""+gForeground.getValue());
else if (object == bForeground) bForeValue.setText(""+bForeground.getValue());Okay, that's better. It would have been nice if the code was formatted, and if there was about 20% of that code. (Your example could have been just one JLabel and nothing else, for example.)
Anyway, now that you've posted that code, what is your question about it? I see you are calling a "getAvailableFontFamilyNames" method; do you have a question about that? If so, what is the question? -
How to remove special characters while typing data in edit cell in datagrid in flex4
Hi Friends,
I am facing this problem "how to remove special characters while typing data in edit cell in datagrid in flex4".If know anyone please help in this
Thanks,
Anderson.Removes any characters from
@myString that do not meet the
provided criteria.
CREATE FUNCTION dbo.GetCharacters(@myString varchar(500), @validChars varchar(100))
RETURNS varchar(500) AS
BEGIN
While @myString like '%[^' + @validChars + ']%'
Select @myString = replace(@myString,substring(@myString,patindex('%[^' + @validChars + ']%',@myString),1),'')
Return @myString
END
Go
Declare @testStr varchar(1000),
@i int
Set @i = 1
while @i < 255
Select
@TestStr = isnull(@TestStr,'') + isnull(char(@i),''),
@i = @i + 1
Select @TestStr
Select dbo.GetCharacters(@TestStr,'a-z')
Select dbo.GetCharacters(@TestStr,'0-9')
Select dbo.GetCharacters(@TestStr,'0-9a-z')
Select dbo.GetCharacters(@TestStr,'02468bferlki')
perfect soluction -
Adding text to PDF using iText instead of CFPDF
Hi,
I know this may seem a bit off topic being posted here but i'm asking this board since i'm a complete JAVA noob and i figure some of you CF folk might have had to do this before.
Anyway, about my question...i'm already adding a watermark image to a pdf using iText (CF8) thanks to the help of fellow poster (=cfSearching=). What i'm looking for is the best way to go about adding some text to this same pdf. I need to add 4 lines of text (with specific font and size) and center it underneath the added image. Does anyone have a site they could point me to as to how to add formatted text and how to get the width of that text so as to align it correctly? I've search Google and looked at a lot of JAVA code but being a JAVA noob it's tough to figure out exactly which libs and methods can be used to do this.
Any help would be greatly appreciated!
-MichaelHi again!
Well, the merged image is an idea but i'd rather have it be actual text so that it is at least copy/paste-able if viewed on a computer.
The four lines of text are dynamic (company name, broker name, phone number, email address) and limited to 40 characters. Right now they are being added via CFPDF and DDX and use the following code in the DDX file to add it to the PDF.
<PDF result="DestinationFile">
<PDF source="SourceFile">
<Watermark
rotation="0"
opacity="100%"
horizontalAnchor="#horzAnchor#"
horizontalOffset="#horzOffset#"
verticalAnchor="#vertAnchor#"
verticalOffset="#vertOffset#"
alternation="OddPages"
>
<StyledText text-align="center">
<p font="#font#" color="#color#" >#left(dCompany,maxlinechars)#</p>
<p font="#font#" color="#color#" >#left(dName,maxlinechars)#</p>
<p font="#font#" color="#color#" >#left(dPhone,maxlinechars)#</p>
<p font="#font#" color="#color#" >#left(dEmail,maxlinechars)#</p>
</StyledText>
</Watermark>
</PDF>
</PDF>
Then using the created pdf from above, i use a slightly modified version of the cfscript code ( that uses iText) you provided me previously to add a logo image just above this text. The only changes i made to it were resizing of the image and adding where to place it. Here is that code:
<cfscript>
fullPathToInputFile = "#tempdestfilepath#";
writeoutput("<br>fullPathToInputFile=#fullPathToInputFile#");
fullPathToWatermark = osFile("#request.logofilepath##qord.userlogo_file#",request.os);
writeoutput("<br>fullPathToWatermark=#fullPathToWatermark#");
fullPathToOutputFile = "#destfilepath#";
writeoutput("<br>fullPathToOutputFile=#fullPathToOutputFile#");
ppi = 72; // points per inch
watermark_x = ceiling(#qord.pdftemplate_logo_x# * ppi); // from bottom left corder of pdf
watermark_y = ceiling(#qord.pdftemplate_logo_y# * ppi); // from bottom left corder of pdf
fh = ceiling(0.75 * ppi);
fw = ceiling(1.75 * ppi);
if( not fileexists(fullPathToInputFile) )
savedErrorMessage = savedErrorMessage & "<li>Input file pdf for logo add does not exist<br>#fullPathToInputFile#</li>";
else
try {
// create PdfReader instance to read in source pdf
pdfReader = createObject("java", "com.lowagie.text.pdf.PdfReader").init(fullPathToInputFile);
totalPages = pdfReader.getNumberOfPages();
// create PdfStamper instance to create new watermarked file
outStream = createObject("java", "java.io.FileOutputStream").init(fullPathToOutputFile);
pdfStamper = createObject("java", "com.lowagie.text.pdf.PdfStamper").init(pdfReader, outStream);
// Read in the watermark image
img = createObject("java", "com.lowagie.text.Image").getInstance(fullPathToWatermark);
w = img.scaledWidth();
h = img.scaledHeight();
//$is[0] = w
//$is[1] = h
if( w >= h )
orientation = 0;
else
orientation = 1;
fw = max_h;
fh = max_w;
if ( w > fw || h > fh )
if( ( w - fw ) >= ( h - fh ) )
iw = fw;
ih = ( fw / w ) * h;
else
ih = fh;
iw = ( ih / h ) * w;
t = 1;
else
iw = w;
ih = h;
t = 2;
// adding content to each page
i = 0;
//while (i LT totalPages) {
i = i + 1;
content = pdfStamper.getOverContent( javacast("int", i) );
img.setAbsolutePosition(javacast("float", watermark_x), javacast("float", watermark_y));
if(t==1)
img.scaleAbsoluteWidth( javacast("float", iw) );
img.scaleAbsoluteHeight( javacast("float", ih) );
content.addImage(img);
WriteOutput("Watermarked page "& i &"<br>");
//WriteOutput("Finished!");
catch (java.lang.Exception e) {
savedErrorMessage = savedErrorMessage & "<li>#e#</li>";
// closing PdfStamper will generate the new PDF file
if (IsDefined("pdfStamper")) {
pdfStamper.close();
if (IsDefined("outStream")) {
outStream.close();
</cfscript>
The above code resized the image to a certain width/height if needed and adds it to the pdf.
I just figured they might be a way to tap into one of the java objects that would allow adding the text. Ideally, adding the text and image to some sort of 'bounding box' that would allow centering of the image and text in relation to that bounding box. Or if there is no way to add to a bounding box, a way to get the horizontal length of the longest line of text so i could calculate a common centerline for the image and text.
I've attached the following pdf to show how the image and text would look together. This example is not to scale but a similar image and text would be added to a separate pdf.
Thanks for you help. -
Problem while generating PDF using iText
Hi:
I have generated PDF using iText, where i have written all code in sequential flow.
<code>
com.lowagie.text.Document document = new com.lowagie.text.Document(PageSize.A4, 55, 5, 20, 20);
OutputStream outputstream = response.getOutputStream();
PdfWriter.getInstance(document,outputstream);
</code>
And i have added all fields in the document.
But my problem is how to display total pagecount on all pages e.g.1\20 (because i have generated PDF sequentially)
Also i want to add watermark on all pages.
So, can any body help me to solve this problem?
Thank You,
Balajisabre150 wrote:
Maybe http://itext-general.2136553.n4.nabble.com/
Nice pron link in there :/ -
Creating PDF using ITEXT API's - error
Hi,
In my WebDynpro Application I want to generate a PDF (using ITEXT API's) out of the data retrieved from back end system .
I used this source code.
Document document = new Document(PageSize.A4);
document.open();
PdfPTable table = new PdfPTable(1);
PdfPCell cell;
cell = new PdfPCell(new Paragraph("ONE"));
table.addCell(cell);
cell = new PdfPCell(new Paragraph("TWO"));
table.addCell(cell);
document.add(table);
document.close();
byte[] b = new byte[100 * 1024];
b = document.toString().getBytes("UTF-8");
IWDCachedWebResource pdfRes = WDWebResource.getPublicCachedWebResource(b, WDWebResourceType.PDF, WDScopeType.CLIENTSESSION_SCOPE, wdThis.wdGetAPI().getComponent().getDeployableObjectPart(),"FileNameHelloText"));
I have used Window Manager to create a external window with the URL from pdfRes.getUrl() method.
After execution i get a pop up window with out PDF document.
Please let me know your thoughts & solutions to the above mentioned problem.
Thanks
SenthilHello Folks,
Use the following snippet of the code to generate PDF using ITEXT API.
Document document = new Document(PageSize.A4);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PdfWriter.getInstance(document, bos);
document.open();
PdfPTable table = new PdfPTable(1);
PdfPCell cell;
cell = new PdfPCell(new Paragraph("ONE"));
table.addCell(cell);
cell = new PdfPCell(new Paragraph("TWO"));
table.addCell(cell);
document.add(table);
document.close();
byte [] byteContent = bos.toByteArray();
IWDCachedWebResource cachedResource =
WDWebResource.getPublicCachedWebResource(
byteContent,
WDWebResourceType.PDF,
WDScopeType.CLIENTSESSION_SCOPE,
wdThis
.wdGetAPI()
.getComponent()
.getDeployableObjectPart(),
"TestPDF");
IWDWindow externalWindow =
wdComponentAPI
.getWindowManager()
.createExternalWindow(cachedResource.getURL(), "PDF Window",true);
externalWindow.open();
Thanks and Regards,
Gopi
Maybe you are looking for
-
Need function module or Bapi name for uploading CJ02 tcode
Hi All, When i am trying to record the data for TCODE : CJ02 i need to enter the project Definition and enter the WBS element it takes me to the screen then i should select the WBS element and attach a file for that selected WBS element . The option
-
Hi experts, I entered all of the initial value of G/L accounts and BP. but when I checked them in financical report --> balance sheet, I found all of them are zero. In financial->chart of accounts, I sure there exists initial value in each account. w
-
FP9 won't install after uninstall
I'm using swfobject and expressinstall to load a Flash8 movie. I have expressinstall working in Firefox, but not in IE7. The Adobe autoupdater loads the update files but Flash Player can't be found. Here's my HTML: <div id="fcmain"> <div id="fctext">
-
I'd like to put a song as a ringtone for the iphone and I do not know how to do it
-
hi all, can u plx to suggest me one function to remove the rights 0's after comma? I do it with offset, but I need a function: here my code: obs: I'm doing it to study... DATA: num(50) VALUE '1101010.100110000000000000', num2(50), cont(2)