WebDatawindow.net Save As PDF creates 0 byte pdf file

Hello all,

I am having issues with the save as pdf function of the web datawindow.  I 
am using the ghostwriter ps method and have confirmed with another app that 
the ps generation is working properly.  I have also confirmed that the 
datawindow is throwing a ps file in the windows temp directory during 
execution of this method.  However, the pdf file generated is always 0 
bytes.

For whatever reason i am finding the documentation hard to understand and im 
sure its a setup problem on my behalf.  Like placement of the "gs" directory 
and needed dl's missing or not in the right "bin" directory and so forth.

Might anyone shed some light or give a simple version of how to get 
ghostwriter / .NET to be happy with the save as pdf stuff?  For example im 
not totally sure what i need in my web apps bin directory.

Oh and i am not getting any error codes or bad return codes from the 
datawindow control.   As far as its concerned all is well, however the 0 
byte file says I've messed up something.

Thanks in advance for your time,

Chris


0
Chris
11/14/2005 4:58:33 PM
sybase.datawindow.net 2302 articles. 0 followers. Follow

2 Replies
732 Views

Similar Articles

[PageSpeed] 55

Hi,

As this happens on the server side, did you set all the properties to
restore the state before you generate the pdf?

AutoRestoreDataCache="True" 
AutoSaveDataCacheAfterRetrieve="True"



    protected void bnSavePDF_Click(object sender, EventArgs e)
    {
        String pdfFileName;
        String pdfUrl;
        String uniqueName; 
        
        uniqueName = System.Guid.NewGuid().ToString() + ".pdf";
        pdfUrl = "pdfs/" +  uniqueName;
        pdfFileName = Page.MapPath("") + "\\pdfs\\" + uniqueName; 
        
        dwReport.SaveAs(pdfFileName,
Sybase.DataWindow.FileSaveAsType.Pdf); 
        HtmlGenericControl body;
        body = this.FindControl("PageBody") as HtmlGenericControl;
        body.Attributes.Clear(); 
        body.Attributes.Add("onLoad", "pdfWindow=window.open   ('" +
HttpUtility.UrlEncode(pdfUrl) +    "', 'pdf',
'dependent');pdfWindow.focus();"); 
        body.Attributes.AddAttributes(new
HtmlTextWriter(Response.Output));

    }


Note:

Your body html tag has to look like the one below to get it to work:

<body  id="PageBody" runat="server">



On 14 Nov 2005 08:58:33 -0800, "Chris Stevenson"
<chris.stevenson@powervisionsw.com> wrote:

>Hello all,
>
>I am having issues with the save as pdf function of the web datawindow.  I 
>am using the ghostwriter ps method and have confirmed with another app that 
>the ps generation is working properly.  I have also confirmed that the 
>datawindow is throwing a ps file in the windows temp directory during 
>execution of this method.  However, the pdf file generated is always 0 
>bytes.
>
>For whatever reason i am finding the documentation hard to understand and im 
>sure its a setup problem on my behalf.  Like placement of the "gs" directory 
>and needed dl's missing or not in the right "bin" directory and so forth.
>
>Might anyone shed some light or give a simple version of how to get 
>ghostwriter / .NET to be happy with the save as pdf stuff?  For example im 
>not totally sure what i need in my web apps bin directory.
>
>Oh and i am not getting any error codes or bad return codes from the 
>datawindow control.   As far as its concerned all is well, however the 0 
>byte file says I've messed up something.
>
>Thanks in advance for your time,
>
>Chris
>
0
Berndt
11/15/2005 10:19:53 PM
Here's my personal cheat-sheet for deploying DW.NET 1.5 with Ghostscript, 
hope it helps.

1. Copy the web application folder from the development PC to the server.
2. Make sure that ASPNET and IUSR_SVR_WEB have full access to the deployment 
folder.
3. In IIS, create a virtual directory pointing to each project.
4. Set the start page for the virtual directory, if necessary.
5. Create a folder for the Datawindow.NET runtime files.  I used 
C:\dwdotnet15.  Create an environment variable called DWDOTNET15 which 
points to this folder.  Set the access for this folder just like the project 
folder.
6. Deploy the necessary runtime files as specified in the docs.  Be sure to 
include atl71.dll, msvcp71.dll, msvcr71.dll, and gdiplus.dll.  The last file 
is only necessary if you are deploying to a Windows 2000 server; Window 2003 
already has this in the operating system.  You can get this file from a 2003 
or XP machine, or download it from Microsoft.

The next step is needed if you are going to generate PDF's with the web 
application.
1. Install Ghostscript.  Set the installation folder to be C:\dwdotnet15\gs. 
(This MAY not be necessary, but it works.)
2. Copy the drivers folder from the Datawindow.NET folder on the development 
machine to the C:\dwdotnet15 folder.  This has the postscript files.  It 
should be the same driver folder that we use when setting up Ghostscript on 
a regular PC for Alchemy.
3. Create the Sybase Datawindow PS printer.  You can do this manually, by 
adding a printer, setting the port to file, using the "have disk" option, 
and pointing to the adist5.inf file in the drivers folder.
4. You need to make some changes in the registry to make the printer 
settings available to the System account.  See page 126 of the 
Datawindow.NET programming reference.  Don't forget to restart IIS when you're 
done.
5. You'll also need to change the machine.config file under the .NET 
framework folder.  Note: everytime you upgrade .NET, you'll need to make 
this change.  See page 125 of the Datawindow.NET programming reference.

One more thing.  I created a clearall.bat file in the deployment folder that 
deletes the junk files that are created by Datawindow.NET (.js, .css, .pdf). 
Run the Task Scheduler program on the server to execute this batch file 
every night, otherwise the server will fill up.

Also, it's helpful to modify the web.config file so that you can see what 
the errors are.  Change it to RemoteOnly to secure the site, or change it to 
Off to see the messages.

Pat


"Chris Stevenson" <chris.stevenson@powervisionsw.com> wrote in message 
news:4378c239$1@forums-1-dub...
> Hello all,
>
> I am having issues with the save as pdf function of the web datawindow.  I 
> am using the ghostwriter ps method and have confirmed with another app 
> that the ps generation is working properly.  I have also confirmed that 
> the datawindow is throwing a ps file in the windows temp directory during 
> execution of this method.  However, the pdf file generated is always 0 
> bytes.
>
> For whatever reason i am finding the documentation hard to understand and 
> im sure its a setup problem on my behalf.  Like placement of the "gs" 
> directory and needed dl's missing or not in the right "bin" directory and 
> so forth.
>
> Might anyone shed some light or give a simple version of how to get 
> ghostwriter / .NET to be happy with the save as pdf stuff?  For example im 
> not totally sure what i need in my web apps bin directory.
>
> Oh and i am not getting any error codes or bad return codes from the 
> datawindow control.   As far as its concerned all is well, however the 0 
> byte file says I've messed up something.
>
> Thanks in advance for your time,
>
> Chris
>
> 


0
Pat
11/16/2005 5:09:08 PM
Reply:

Similar Artilces:

save as pdf creates a 0 byte file
Hi, I'm using the DW.Net 2.0 and VS 2005 (8.0.50727.42). When i run the example "Web Datawindow PDF Client Sample a Pdf- file with 0 Byte size is created. I modified the registry as described in Chapter 9 of the Programmers Guide. I also modified the machine.config to run under system account as follows: <processModel enable="true" userName="SYSTEM" password="AutoGenerate" /> I installed the ghostscript 8.15. Can anyone help me? Regards Ralf Did you install the new Adobe Printer and call it Sybase? > Hi, > I'm ...

Save as PDF Composite Datawindow.net 2.0
Hi, I am using VS 2005 and Datawindow.net 2.0. I am writing a window application. I am having trouble saving composite datawindow into pdf. I had installed GhostScript. At datawindow design time, I am able to save row as pdf. At run time, it's working fine on other datawindow except composite datawindow. Is this a bug in Datawindow.net 2.0? On a previous Datawindow.net 1.51 I have no problem until I migrated my program to datawindow.net 2.0. Is there a solution or a work around for this? Thank you very much, ...

Changing the default All Files (*.*) option to Adobe PDF Files (*.pdf) in a file open dialogue in ASP.net
In My file Upload page, I am using <input type=file> tag to browse a file from client machine.The Browse button by default is showing all files *.* in the file dialogue boxI have a requirement like the file dialogue should by default show just PDFs *.pdf, and have an option to show all files *.* as shown below:Adobe PDF Files (*.pdf)All Files (*.*)Is there a way to handle this using any web controls, or technique using ASP.net or HTML?Thanks in advanceAnsar I need answer to this one, too. As far as I know, there is no way to do this....

Save pdf from posted pdf (asp.net)
I've got a pdf form with a submit button and I've set it up to post the entire pdf to a url. Now - what I want to do is grab that pdf from the web page that it posts to. I've got a pdf .net component for editing and saving the pdf, I just need to know how to pick up the pdf form the post.. If that makes sense.. Once I have grabbed the pdf, I can save it no problem, I just need to grab the pdf object from the http post request.  Any ideas?http://www.developdesign.co.uk/ Request.Form("what_you_posted_it_as") But that expects a string surely -  the compo...

PDF Metamorphosis .Net
Hi ASP.Net community, If you will need an easy in .Net component to convert RTF, Text to PDF from ASP.Net (C#, VB.Net) you can try our PDF Metamorphosis .Net: http://www.sautinsoft.com/products/pdf-metamorphosis/index.phpThe component is standalone and independent, it doesn't require anything else.In this package there are samples of Web-application and C#, VB.Net console applications. To convert RTF to PDF in C# you will need only two lines: SautinSoft.PdfMetamorphosis p = new SautinSoft.PdfMetamorphosis();//filesp.RtfToPdfConvertFile(@"d:\test.rtf", @"d:\test.p...

How to create a pdf file in asp.net with c# as one of the output file?
Hi All,I need to know whether creating a pdf file through asp.net is possible or not? For instance, i can create a excel file to export data as output. Likewise, i need to export some information in pdf format. It should then open and show the contents. Going further in this, can we also customize like displaying the user-login name as watermark so that each pdf created for every user is unique to him. How to achieve this task? Do we need to install any third party components which will provide methods/namespaces etc or can we do without any third party components?After reading many related ...

Create pdf file in asp.net
Anyone knows any open source I can use to create the pdf file in my asp.net web site?...

create a PDF-File in a .NET application
Hi How Can I create a pdf file in asp.net dynamically Thanks jj There are several components listed in the Control Gallery that provide that ability.JimMS MVP ASP.NET [VC++/MFC emeritus]Old Dog Learns New TricksPreferred programming language: cuneiform on clay tablets...

Create PDF file using .NET
Hello List, Can someone tell me how can I create PDF file using .NET? Thanks in advance, Peter, Hi, Tale a look @ ABCpd HTH K B ShajudeenAreYaar.comDubai, United Arab Emirates. Also, Siberix PDF Library for .NET is available as a trial download. I had the trial up and running in minutes. Couldn't have been easier ...Alister Below post has some related info http://asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=380008Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti...

creating .pdf files from Asp.net
can anyone help me on this issue I need to create a .pdf   file  and write some  content to  it How  do we do it  in ASP Thanks Akila There are literally hundreds of 3rd party components to do this. You'll find a few of them in the Control Gallery of the ASP.NET site, but a quick Google search for pdf+generator+asp.net will yield a lot more.RegardsDave Hy..  Try these links : 1:  http://www.colorpilot.com/pdfsample_asp.html  2:  http://www.15seconds.com/issue/990902.htm Rgds.  ...

How to create PDF files from ASP.NET pages
Hi, Let me first explain my requirement that i am trying to achieve. I am developing a .aspx page,which will be an entry form type ( say a normal form entry type).At the end of the form there is a button say "Submit".When the user clicks on the button the user is being redirected to a confirmation page and at that time a  unique id is being generated for further reference and below that there is a link say "Application in PDF format".When the user clicks on the link the user is able to see the form entered in the PDF format and if needed is able to t...

How to create PDF file using asp.net
Hi AllI want to create pdf file of data coming from database, or u can say i want to create pdf file of one of my report. I saw one script in that they said Visual Studio .NET comes with a useful version of Crystal Reports which allows you to create Crystal Reports (.rpt files) and then bind them to your database to produce PDF files on a web page, all from within the Visual Studio .NET GUI without ever even getting into the code. As easy as this is, you can have a lot more control over the process if you do it yourself. i dont understand exactly what it means? I am new to .ne...

How can I create pdf files by ASP.Net ?
How can I create pdf files by ASP.Net ?Please tell me a sample to creating. You can use iTextSharp. Its free.ThanksDinuj Nath...

Saving a Web Page as a Pdf file in .Net
Any suggestions of the top software to use to save a web page as a pdf file. Thanks...

Web resources about - WebDatawindow.net Save As PDF creates 0 byte pdf file - sybase.datawindow.net

Resources last updated: 12/29/2015 7:50:44 AM