Some pointers:

- the PDF is only available after Close().

- use MemoryStream.ToArray() to get the PDF after Close().

Paulo 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Johnny Granberg
> Sent: Thursday, March 15, 2007 3:11 PM
> To: [email protected]
> Subject: [iText-questions] Problems storing the PDF data in a 
> memorystream
> 
> First of all im using itextsharp in a .NET environment, but 
> apparently it's the same API as the java itextsharp
> 
> And now on to my problem:
> 
> Scenario:
> 
> I am downloading a PDF from a database and store it in a 
> memorystream, then I open it up in itextsharp using the 
> pdfreader and then I fill out some form fields.
> 
> After that I want to use the flattened PDF page in yet 
> another document, thus saving the memory stream into a buffer 
> and using that to insert the flattened form into a pdfwriter
> 
> This Is the code that reads fills the form, the memorystream 
> ends up with only 16 bytes... and the document is way bigger than
that:
> 
> --------------------------------------------------------------
> ---------------------------------------
> 
>                       Dim TemplateData As OracleBlob = _
> 
>            
> DirectCast(OraCommand.Parameters(":template_data").Value, OracleBlob)
> 
>                 Dim templByteArray(CInt(TemplateData.Length)) As Byte
> 
>                 TemplateData.Read(templByteArray, 0, 
> CInt(TemplateData.Length))
> 
>                 Dim reader As PdfReader = New 
> PdfReader(templByteArray)
> 
>                 Dim ms As New MemoryStream
> 
>                 Dim stamper As PdfStamper = New PdfStamper(reader, ms)
> 
>                 Dim fields As AcroFields = stamper.AcroFields
> 
>                 fields.SetField("kassler", "1")
> 
>                 stamper.FormFlattening = True
> 
>                 Dim buffer(CInt(ms.Length)) As Byte
> 
>                 ms.Read(buffer, 0, CInt(ms.Length))
> 
>                 stamper.Close()
> 
>                 Dim bl As Long = buffer.Length
> 
> --------------------------------------------------------------
> ---------------------------------------
> 
> Does anyone know how I can make this work?
> 
> Thanks in advance.
> 
> 


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.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to