PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Wed Nov 05, 2025 9:50 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Rendering in Browser
PostPosted: Thu Jul 11, 2013 6:22 pm 
Offline

Joined: Thu Jul 11, 2013 6:12 pm
Posts: 2
I have had this code for quite some time and it has worked flawlessly. We use PDF sharp to import PDF files that have been sent to use via FTP. About 2 days ago the PDFs just began not rendering in any browser(IE, firefox, Chrome). There were not any code changes. Here is the code that I am using the resulting output.

This grabs the binary data from the database and serves it up to a web page(This is asp.net with VB)
Dim img As B2BBusinessObjects.RepositoryDocument = New RepositoryDocument(imageID)
Dim buf As Byte() = RepositoryDocument.GetDocument(imageID)
Response.BinaryWrite(buf)

This HTML grabs the document from the served page above(GetDocumentURL() returns the URL of the page that uses the above code)
<div id="objImage" height="100%" runat="server">
<object width="100%" height="800px" classid="CLSID:106E49CF-797A-11D2-81A2-00E02C015623">
<param name="src" value="<%= GetDocumentURL() %>" />
<embed width="100%" height="800px" src="<%= GetDocumentURL() %>" type="application/pdf" />
</object>
</div>

This results in the following output which used to be a nice PDF up until a few days ago. This is just a snippet
%PDF-1.4 %���� % PDFsharp Version 1.32.2608.0 (verbose mode) % Creation date: 4/25/2013 3:00:13 PM % Creation time: 0.047 seconds % File size: 120623 bytes % Pages: 1 % Objects: 7 %-------------------------------------------------------------------------------------------------- 1 0 obj % PdfSharp.Pdf.PdfDocumentInformation << /CreationDate (D:20130425150013-04'00') /Creator () /Producer (PDFsharp 1.32.2608-g \(www.pdfsharp.net\)) /Title (Page 1 of ) >> endobj %-------------------------------------------------------------------------------------------------- 2 0 obj % PdfSharp.Pdf.Advanced.PdfCatalog << /Pages 3 0 R /Type /Catalog >> endobj %-------------------------------------------------------------------------------------------------- 3 0 obj % PdfSharp.Pdf.PdfPages << /Count 1 /Kids [7 0 R] /Type /Pages >> endobj %-------------------------------------------------------------------------------------------------- 4 0 obj % PdfSharp.Pdf.PdfDictionary << /ProcSet [/PDF /ImageB] /XObject << /Im1 5 0 R >> >> endobj %-------------------------------------------------------------------------------------------------- 5 0 obj % PdfSharp.Pdf.PdfDictionary << /BitsPerComponent 1 /ColorSpace /DeviceGray /DecodeParms << /Columns 2552 /Rows 3300 >> /Filter /CCITTFaxDecode /Height 3300 /Length 118042 /Subtype /Image /Type /XObject /Width 2552 >> stream YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYi�� "6b���ي��.�j��1Pvh��LU�2�C�� ��f��D�D��!d��4°�ؒBM���:���!e��W\Ou���…���P�C�Q��C��G��O&Āf�U��N���z~r���%vt8'a�8H�lHvi�u��J��8��Ghq� w�c��Cŋ��!���f}~<��>:�t?��S�;���m�b�4�-����1�,��N�C�������up���+�Z� �v���7C̗����


Top
 Profile  
Reply with quote  
 Post subject: Re: Rendering in Browser
PostPosted: Mon Jul 15, 2013 7:48 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3136
Location: Cologne, Germany
Not my area of expertise, but IMHO it can't hurt to specify on the server that it is sending a PDF file:
Code:
  Response.Clear();
  Response.ContentType = "application/pdf";
  Response.AddHeader("content-length", stream.Length.ToString());


See also:
http://www.pdfsharp.net/wiki/Clock-sample.ashx

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Rendering in Browser
PostPosted: Mon Jul 15, 2013 7:47 pm 
Offline

Joined: Thu Jul 11, 2013 6:12 pm
Posts: 2
This did not correct the issue.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider] and 91 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group