Creating a PDF-File from a report within a service

Hello,
I have to create PDF-Files from a report within a windows service.
My source is as follows (quick and dirty) using Microsoft Report Viewer 2012
Imports Microsoft.Reporting.WinForms
Dim reportViewer1 As New Microsoft.Reporting.WinForms.ReportViewer()
Dim objRDLC As New Microsoft.Reporting.WinForms.LocalReport()
reportViewer1.LocalReport.ReportEmbeddedResource = "MyApplication.MyReport.rdlc"
Dim deviceInfo As String = "<DeviceInfo>" & _
"<OutputFormat>PDF</OutputFormat>" & _
"<PageWidth>21cm</PageWidth>" & _
"<PageHeight>29.7cm</PageHeight>" & _
"<MarginTop>0.7cm</MarginTop>" & _
"<MarginLeft>0.7cm</MarginLeft>" & _
"<MarginRight>0cm</MarginRight>" & _
"<MarginBottom>0cm</MarginBottom>" & _
"</DeviceInfo>"
objRDLC.DataSources.Clear()
'Fill Report with data
reportViewer1.LocalReport.DataSources.Clear()
reportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("dsInfo", dt))
reportViewer1.RefreshReport()
'Output Report as File
Dim byteViewer As Byte() = reportViewer1.LocalReport.Render("PDF", deviceInfo)
Dim newFile As New FileStream("MyFileName", FileMode.Create)
newFile.Write(byteViewer, 0, byteViewer.Length)
newFile.Close()
'Clean up
newFile.Dispose()
objRDLC.DataSources.Clear()
objRDLC.Dispose()
reportViewer1.Dispose()
In most cases everything works fine.
But the service crashes after some/many reports (e.g. after 270 reports or after 1.400 reports). There is no fix number of reports that causes the service to crash.
The service crashes with the following error:
System.ComponentModel.Win32Exception (0x80004005): Fehler beim Erstellen des Fensterhandles.
   bei System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
   bei System.Windows.Forms.Control.CreateHandle()
   bei System.Windows.Forms.Control.get_Handle()
   bei System.Windows.Forms.Control.PointToScreen(Point p)
   bei System.Windows.Forms.ToolStripItem.TranslatePoint(Point fromPoint, ToolStripPointType fromPointType, ToolStripPointType toPointType)
   bei System.Windows.Forms.ToolStripDropDownItem.DropDownDirectionToDropDownBounds(ToolStripDropDownDirection dropDownDirection, Rectangle dropDownBounds)
   bei System.Windows.Forms.ToolStripDropDownItem.GetDropDownBounds(ToolStripDropDownDirection dropDownDirection)
   bei System.Windows.Forms.ToolStripDropDownItem.get_DropDownLocation()
   bei System.Windows.Forms.ToolStripDropDown.GetDropDownBounds(Rectangle suggestedBounds)
   bei System.Windows.Forms.ToolStripDropDown.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
   bei System.Windows.Forms.Control.SetBounds(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
   bei System.Windows.Forms.Control.set_Size(Size value)
   bei System.Windows.Forms.ToolStripDropDown.AdjustSize()
   bei System.Windows.Forms.ToolStripOverflow.OnLayout(LayoutEventArgs e)
   bei System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
   bei System.Windows.Forms.Control.PerformLayout()
   bei System.Windows.Forms.Control.ResumeLayout(Boolean performLayout)
   bei System.Windows.Forms.Control.ResumeLayout()
   bei System.Windows.Forms.ToolStrip.OnLayout(LayoutEventArgs e)
   bei System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
   bei System.Windows.Forms.Control.PerformLayout()
   bei System.Windows.Forms.Control.ResumeLayout(Boolean performLayout)
   bei System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
   bei System.Windows.Forms.TextBoxBase.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
   bei System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(Rectangle bounds, BoundsSpecified specified)
   bei System.Windows.Forms.ToolStripControlHost.OnBoundsChanged()
   bei System.Windows.Forms.ToolStripItem.SetBounds(Rectangle bounds)
   bei System.Windows.Forms.ToolStripItem.set_Width(Int32 value)
   bei Microsoft.Reporting.WinForms.ReportToolBar..ctor()
   bei Microsoft.Reporting.WinForms.ReportViewer.InitializeComponent()
   bei Microsoft.Reporting.WinForms.ReportViewer..ctor()
   bei DC5Warteschlange.clsReportTools.Druck(DataTable dt, String Reportname, String ReportDataset, String Drucker, String Format, String Datei)
   bei DC5Warteschlange.clsInfoQueue.Snotiz(String[] CallIDs, String Speicherort)
   bei DC5Warteschlange.Imail.InformationMailSenden(Int32 AID, DataTable& tmpDT)
Thank you very much....
Gernot

Unfortunately, it is not a piece of code that I can send. The SQL would be embedded inside Oracle Reports tool, and you would have the option to save the output of the report in PDF format.
Once you have the Oracle Report developed, you can execute it from command line prompt and save the output to a pdf file. In your case, the cursor would be embedded inside Oracle Report
Shakti
http://www.impact-sol.com
Developers of Guggi Oracle - Tool for DBAs and Developers

Similar Messages

  • Generate PDF file from a report using greek characters

    Dear all,
    I tried to generate a PDF file from a Report having greek characters on it.While in previewer I could see everything OK, when PDF file was generated all greek characters had been substituted by symbols...
    Any ideas, suggestions and workarounds are welcome.
    Thanx a lot!

    hi Kiriakos,
    which version are you using ?
    please test this with reports 9i since PDF support
    has been enhanced there.
    to test i would suggest to run the report from rwclient
    as well and specify desformat=pdf and to a generate to
    file within builder to see if the same behavior occurs.
    if this problem reproduces there as well i suggest
    to contact oracle support to log the problem.
    regards,
    christian

  • How to create a pdf file from multiple images ?

    Dear All,
    I want to create a SINGLE page pdf file from two or more page size images that are combined to make a single page pdf. Again, this question is on pdfs that are made out of several, atleast  two color images and a black-and-white mask for one of them.
    I have such pdf files from an unknown source (the producer is edited out) whereby there are three tiff images, obtained using the well known pdfimages extractor.
    When I want to make a pdf out of tiff or png or other image formats, I right click and tell Adobe Acrobat to make a pdf.
    However, I dont know how I can give a command to select say,  three tif images and specify which is the mask for which and then join  them in a way that I get the pdf from the composite of the two color images and a mask for one of them.
    Please help me out.
    I am a little familiar with the pdf structure skeleton and when necessary, fixed xref tables in one of my favorite editors. A few years ago, I also wrote a bunch of javascripts to make some annotations and needed some automation and used some itext type libraries. However, I need your help in this problem as I am now rusty and forgot some of what I studied to solve my earlier problems. This is a new problem for me. Gentle hints from you would be very nice to help me in this problem. Please specify if necessary what manual and pages to read. in the pdfspec.
    Best Regards
    Disabled Veteran [physically handicapped]

    Hello Again.
    On Fri, May 11, 2012 at 12:20 PM, lrosenth <[email protected]> wrote:
    >
    > Re: How to create a pdf file from multiple images ?
    >
    > created by lrosenth in PDF Language and Specifications - View the full
    > discussion
    > ________________________________
    >
    > No clue who Irving is…
    >
    I was hoping to have your first name so its easy for me to address you.
    > I have no clue what OS platform, programming language, etc. you use so
    > can’t really narrow things down.
    I would gladly mention that I am working on windows platform, preferably XP.
    I can also work on linux for free products that come with it.
    >  Also, as this is an Adobe forum, we only
    > recommend Adobe products – so there may be other options that even my list
    > wouldn’t include.
    But adding other products, for the help of an adobe products user,
    even if it outside adobe, shall add greater prestige to your company
    and give impression of user-centeredness.
    > If you read ISO 32000-1:2008 (aka the PDF standard), you will find the
    > information about Images and Image Masks well described.  I didn’t think I
    > needed to repeat any of that information.
    Well, just add the few pdf stanzas since you are proficient on it and
    I am presently a little rusty as I mentioned. Just asking a little
    extra yard, not even to go an extra mile.
    > And, if you read that same document, you will see that there is NO SUCH
    > THING as a “text only PDF”.   All PDF documents are structured binary files.
    Well, ascii format or uncompressed format that is human readable. I
    know its a binary file, but human readable ascii version of it.
    I hope you can give me some stanza and various other approaches
    possible so I can select or combine things for myself. I see only a
    miniscule number of posts claiming to have written masks in this forum
    and then with no details.
    Regards
    Roger
    Message was edited by: dying veteran
    because the adobe posting system went crazy and truncated all except the first line ... dunno why

  • Using Acrobat X and creating a PDF File from EXCEL 2010, I notice that the Pagination restarts at 1 for each Worksheet included in the PDF.

    I use Acrobat X Standard and created a PDF file from two or more worksheets using EXCEL 2010.
    The resulting PDF file restarts the PAGE # (In header/footer settings of Excel) at 1 for each worksheet.
    However, a colleague of mine who has Acrobat X Pro version, using EXCEL 2010 and same exact file does the same task, he gets a file that starts at page 1 and second worksheet continues the page # from the last page of the First worksheet.
    We both are using the ACROBAT menu (not the print to Adobe printer) to create the file so that we can get Bookmarks included in the resulting file for each worksheet.
    We cannot figure out any option in Acrobat's preferences that controls the pagination on either of these versions of Acrobat.
    So is this just a feature that works one way in Standard version and another way in the Pro version, and the user has no control over it?

    This is so sad. I read your comments and I said, "Huh?" Haha!
    I tried the indexed color option and it did make the final file smaller. Around 600KB. But there's probably another way to make it even smaller like the gazillion-paged pdf file that I mentioned that was only about 300KB.
    And by saying a layout program, does that mean like Adobe InDesign? Does that mean that I should just make my graphics in Photoshop and then import using another program and finish the file there?
    What other layout programs can I use?
    Thank you so much!

  • Generated pdf file from oracle reports show bad characters

    Hello all,
    Iam fighting with a problem with generated pdf file from oracle reports which show some bad characters. I was searching for some information but it didnt help...
    I have Oracle Database 11g R2 (or 10g R2) on Oracle Linux or Windows, Oracle forms and reports 6i (i know that is very old and not supported with 11gr2 but we are in this scenario).
    NLS parameters are set like this
    server:
    NLS_CHARACTERSET EE8MSWIN1250
    NLS_TERRITORY AMERICA
    NLS_LANGUAGE AMERICAN
    client:
    NLS_CHARACTERSET EE8MSWIN1250
    NLS_TERRITORY SLOVAK
    NLS_LANGUAGE SLOVAKIA
    When I run Oracle Reports it show perfect in display and when I try to print them, they are all good with good characters, but when I try to generate pdf file, some characters like č,š,ľ are not displaying corectly... This happen only when try to generate to pdf...
    I try to work with uifont.ali on client side but without any result. Fonts for reports were installed on client and server side... Can someone help me with this problem? Thank you very much for every advice.
    Martin

    Hi Sergiusz,
    Thank you for your reply. I look at what you wrote and try to make some test...
    1) For first I download FontForge, which can generate type1 font from true type. So I open FontForge and open my Arial.ttf font and use "Generate Fonts" to save my Arial.ttf font to pfb and pfm (whoch are need to set in uifont.ali). I have to change encoding, because my font has 2byte encoding so I reecondode the font from ISO10646-1 to ISO8859-2 and generate to pfb.
    2) Then I navigate REPORTS_PATH from regedit to my *.pfm and *.pfb files.
    3) I add these lines to end of my uifont.ali
    [ PDF:Embed ]
    Arial = "Arial.pfm Arial.pfb"
    ArialNarrow = "ArialNarrow.pfm ArialNarrow.pfb"
    4) Then I generate my report but nothing change... I check "Font used" in my pdf file, but there were not my fonts embedded I guess..
    I also try PDF:Subset, but it doesnt change anything... I try PDF aliasing to see if my uifont is working - this work very well, but I dont need to change font...
    Any other advice? Thank you so much to everyone!
    Martin

  • Create a pdf file from Outlook e-mails

    How can I create a pdf file from my Outlook e-mails?  I would like to export all of the e-mails for each client into a pdf once I close their file.  Help!

    Hello,
    Please look at the following demo video to know how to convert Outlook email to PDF.
    http://acrobatusers.com/tutorials/how-convert-outlook-email-pdf
    Regards,
    Anoop

  • How can i create a pdf file from Indesing, whit out loosing resolution...

    How can i create a pdf file from Indesing, whit out loosing resolution...
    in linked images (bitmap) idon´t know where or how can i keep the same resolution "image" that is from the original file ......

    In the export settings there is a panel called Compression. You can set downsampling and compression, or lack thereof, there.

  • I have always had trouble (including error messages)when opening pdf files from a website within Firefox

    More often than not when I open a pdf file from within Firefox the file fails to open (often you get an error message. "there was an error processing page. A file I/O error has ocurred"). Sometimes the file downloads but is only white pages. I usually then right click the file and save it to my desktop but this is cumbersom!

    Ok two things based on the crash report and the steps you took right before the crash:
    # Try to disable scrolling acceleration and restart Firefox. Does it continue to crash?
    # Try Safe Mode and do the same task as above with email and the pdf [[Troubleshoot Firefox issues using Safe Mode]]
    # Also pdf.js may be helpful to read pdfs in the meantime. You can change the default reader in the Preferences/Options > Application menu of Firefox.
    # Try to clear out the downloads folder and update flash to version 14 (that should do it)
    IF it crashes again please also provide the new crash signatures and we can take a look :-) Sorry for the crashing :-(

  • Generate pdf file from 9i reports and save it in C:\oracle_reports\

    i want to generate a file from oracle reports in PDF format and want to save it on already defined path.
    c:\oracle_reports\
    right now pdf generation of report is working fine but before generation of pdf report system prompt me or open a dialogue box to save my pdf file on drive. i dont want to see these dialogue box or prompt me to explicitly save it.
    i want all the work done automatically.
    regards
    ------------ source code--------------
    PROCEDURE PRINT_PROC IS
    repid REPORT_OBJECT;
    v_rep VARCHAR2(100);
    rep_status VARCHAR2(20);
    pl_id ParamList;
    report_path varchar2(100);
    aud_sno varchar2(1000);
    aud_type varchar2(500);
    BEGIN
         pl_id := Get_Parameter_List('report_data');
         IF NOT Id_Null(pl_id) THEN
              Destroy_Parameter_List( pl_id );
         END IF;
         pl_id := Create_Parameter_List('report_data');
         User parameters : Customize these to fit your report
         report_path := :GLOBAL.Web_BASE_PATH||:GLOBAL.PATH_SCM||'REPORT\scm_rfq.rep';
    -- Initialize your report parameters here
         Add_Parameter(pl_id, 'p_cmp_code'                     , TEXT_PARAMETER, :global.company_code);
         Add_Parameter(pl_id, 'p_rfq_sno'                     , TEXT_PARAMETER, :document_sno);
         Add_Parameter(pl_id, 'P_PATH'                               , TEXT_PARAMETER, REPORT_PATH);
    Standard parameters: Don't change
         Add_Parameter(pl_id, 'PARAMFORM' , TEXT_PARAMETER, 'NO');
         Add_Parameter(pl_id, 'PAGESTREAM' , TEXT_PARAMETER, 'NO');
         Add_Parameter(pl_id, 'MAXIMIZE' , TEXT_PARAMETER, 'YES');
         -- end standard parameters
         repid := find_report_object('REPORT_OBJ');
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,BATCH);
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,CACHE);
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'rep_oas');
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_FILENAME,report_path);
    -- SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'htmlcss');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'pdf');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESNAME,'\\ORCLSRV\UTL_MAIL\'||:doc_type||:receiver_sno||'.pdf');
         v_rep := RUN_REPORT_OBJECT(repid,pl_id);
         rep_status := REPORT_OBJECT_STATUS(v_rep);
         WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
         LOOP
         rep_status := report_object_status(v_rep);
         END LOOP;
    END;

    If you use rwclient you could that easily, from a Form, it requires additional steps.
    Look at this thread Re: save report

  • Possible to create multiple pdf files from links?

    In Acrobat X Pro, is there a way to apply the option "create pdf file from link" to several links on the same website at once?.thanks

    About the closest you can get is to use the Tools > Document Processing > Web Capture > Append all links on page command, which will traverse the links and append them to your existing PDF that has been captured from a web site.

  • Create a PDF file from DWG file

    I would like to know how I can create from a DWG file ( autocad 2006/ 2008) a PDF file, using a computer whitout autocad installated on it. I use already PDF COMPLETE : I can create with this programm a PDF file from a word document but not from a DWG file.

    You can use Acrobat X Pro. to convert your DWG files to PDF without having AutoCad on your system. Here is a chart with additional information.

  • Is anyone know how to create dynamic pdf file from a JSP page or Servlet ?

    Hi
    Is any one know how to create a dynamic PDF file from JSP or servlet. I need to have standard form format needs to be created and want to send the info to that form dynamically.
    Is there any libraries available?
    Thanks

    I posted a link in this thread to a lib that lets you create PDFs from an app. They have a Java version. I have not used it but I know someone who used it with Microsoft ASP and they liked it.
    http://forum.java.sun.com/thread.jsp?forum=31&thread=287285
    -S-

  • How can I create multiple PDF files from multiple InDesign files?

    I have 144 InDesign files that I need to create a PDF file for each. I do not want to open each InDesign file to create the PDF's. Acrobat Batch create won't open the InDesign files. Is there another way?

    Only InDesign can do this. You may want to look at InDesign automation.

  • How to Create a PDF file from database package/procedure in 10g?

    Hi,
    Is there a way to create a pdf file in 10g Application Server using PL/SQL package/procedure in 10g database?
    Thanks in advance.
    Regards
    Vishnu Nekkanti

    http://technology.amis.nl/2010/10/20/as_pdf-generating-a-pdf-document-with-some-plsql/
    http://technology.amis.nl/2012/04/11/generating-a-pdf-document-with-some-plsql-as_pdf_mini-as_pdf3/

  • Create a PDF file from swing component and print

    Hi,
    Suppose i have a JFrame where in i add a JScrollpane which has a JPanel with some painting on it, suppose i want to create a pdf file of the total JPanel, and not of what i see on screen like taking a screen shot, or print the total JPanel, and not only the screen that is displayed
    how can i do it
    I am attaching the code below, how can i create a pdf for MyPanel and print it
    //start code
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TestDisplaySize extends JFrame
         JScrollPane scrollPane ;
         public TestDisplaySize()
              super("layered pane");
              this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              MyPanel panel = new MyPanel();
              scrollPane = new JScrollPane(panel);
              Container contentPane = this.getContentPane();
              contentPane.add(scrollPane, BorderLayout.CENTER);
              setSize(new Dimension(800,600));
              this.setVisible(true);
              JViewport viewPort = scrollPane.getViewport();
         class MyPanel extends JPanel
              public MyPanel()
         setPreferredSize(new Dimension(2000,600) );     
         this.setBackground(Color.white);
         this.setOpaque(true);
         public void paintComponent(Graphics g)
    super.paintComponent(g);
    setBackground(Color.white);
    Rectangle r = scrollPane.getViewport().getViewRect();
    g.setClip((Shape)r);
    g.setColor(Color.blue);
    int x = 0;
    for(int i = 0; i < 60; i++)
         x +=60;
         g.drawLine(x, 0, x, 600);
         g.drawString(String.valueOf(i), x, 50);
         public static void main(String args[])
         new TestDisplaySize();
    //end code

    create a class wich implements printable, redefine the print method of this class with the this you want to print
    and at the end of the constructor...
    PrinterJob printJob = PrinterJob.getPrinterJob();
    PageFormat myFormat = new PageFormat();
    myFormat.setOrientation(PageFormat.LANDSCAPE);
    myFormat.setPaper(ps.getMyPaper());
    printJob.setPrintable(this, myFormat);
    if (printJob.printDialog()) {
    try {
    printJob.print();
    } catch (Exception pe) {
    System.out.println(pe);

Maybe you are looking for

  • Need to repair Time Machine back-up drive

    I have an external back-up for my Time Machine. I think the power went out while it was backing up, and now I can a message that the drive is "read only" or "unavailable." I've tried to fix it using Disk Repair, but I get this message: Verify and Rep

  • Report with a blob

    Hello!! I need make a report with a blob. I have this table: CREATE TABLE DOCUMENTOS ( ID_DOCUMENTO NUMBER NOT NULL, ID_PROY NUMBER NOT NULL, ENCABEZADO VARCHAR2 (100), TEXTO VARCHAR2 (500), PATH BLOB, FECHA_CREACION DATE, TODOS CHAR (1), DGTM CHAR (

  • Duplicates in iTunes Media Folder

    Okay, so first a little background. I had to reformat my Mac awhile back due to an issue with some beta software. Now, my Mac is back to working again... but since I had to redownload everything from iTunes Match to keep from having to redo the match

  • F110 & actual balance in bank account

    Hi All, When we do payment run, system automatically take house bank & bank account configured in FBZP based on payment method given in F110. But if anyhow amount does not actaully exist in that bank account, payment will not go to vendor. So how it

  • Problem with CUA

    Hi Team, we implemented CUA in our CRM system such as NCSCLNT300 was made as CUA and NCSCLNT200 as child system. CUA works well in most cases except for the below issue. 1. For some roles available in client NCSCLNT200, when we try to add it to a use