that worked!!

Paulo Soares-3 wrote:
> 
> Remove mStream.Seek(0, SeekOrigin.Begin).
> 
> Paulo
> 
> ________________________________________
> From: vmathai [[email protected]]
> Sent: Monday, June 22, 2009 4:31 PM
> To: [email protected]
> Subject: [iText-questions] File does not start with %PDF- ( after using
> pdfstamper )
> 
> I have a situation where the user uploads a pdf file (template) and it is
> stored in the SQL Server Table in a field which has an image datatype.
> Everything worked well so far. Now the user wants some data written onto
> the
> pdf dynamically over the template. I used pdfstamper to write the text
> over
> the data retrieved from the table.
> 
> Steps Taken:
> 
> 1) Saved the file to the local harddrive and i was able to bring the pdf
> up
> without any issues.
> 2) Saved it back to the table and while retrieving the pdf via the web
> app.
> I get the error message "File does not start with %PDF-"
> 3) I opened the file via notepad. Before overwriting with data and the
> file
> starts with "%PDF-1.4
> %âãÏÓ
> 1 0 obj<</Subtype...."
> 4) File after overwriting with data : the file looks like this "1 0
> obj<</Subtype/Type1/" and it's clearly missing the PDF related
> information.
> 
> Is there any properties i could use to set the PDF information?
> 
> Has anyone encountered a similar situation? Please help!!
> 
> Thanks in advance,
> -Matt
> 
> Below is the sample code snippet:
> 
> PdfReader pdfReader = new PdfReader(d.DisclosurePdf);
> //PdfReader pdfReader = new PdfReader(@"d:\test\xyz.pdf");
> PdfStamper ps = new PdfStamper(pdfReader, mStream,'\0');
> PdfContentByte under = ps.GetUnderContent(1);
> PdfContentByte over = ps.GetOverContent(1);
> BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI,
> BaseFont.EMBEDDED);
> // text over the existing page
> over.BeginText();
> over.SetFontAndSize(bf, 10);
> over.SetTextMatrix(95, 650);
> over.ShowText(DateTime.Now.ToShortDateString());
> over.EndText();
> over.BeginText();
> over.SetFontAndSize(bf, 10);
> over.SetTextMatrix(250, 650);
> over.ShowText("5000.00");
> over.EndText();
> mStream.Seek(0, SeekOrigin.Begin);
> ps.Close();
> result = mStream.ToArray();
> 
> Aviso Legal:
> Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
> informação confidencial ou legalmente protegida. A incorrecta transmissão
> desta mensagem não significa a perca de confidencialidade. Se esta
> mensagem for recebida por engano, por favor envie-a de volta para o
> remetente e apague-a do seu sistema de imediato. É proibido a qualquer
> pessoa que não o destinatário de usar, revelar ou distribuir qualquer
> parte desta mensagem. 
> 
> Disclaimer:
> This message is destined exclusively to the intended receiver. It may
> contain confidential or legally protected information. The incorrect
> transmission of this message does not mean the loss of its
> confidentiality. If this message is received by mistake, please send it
> back to the sender and delete it from your system immediately. It is
> forbidden to any person who is not the intended receiver to use,
> distribute or copy any part of this message.
> 
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge
> conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference:
> $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
> 

-- 
View this message in context: 
http://www.nabble.com/File-does-not-start-with--PDF--%28-after-using-pdfstamper-%29-tp24149110p24155143.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to