Pdf printing of an image stored in database?
Hi,
I am using pdf printing option, but stuck in a case where I need to retrieve a image from the database table stored as a blob content.
Is it possible to create a report review of this sort?
Is this even possible?
Thanks..
Hello,
Yes, absolutely.
Check out this blog post by Marc Sewtz on how to do it -
http://marcsewtz.blogspot.com/2008/06/one-question-about-pdf-printing-feature.html
Hope this helps,
John.
Blog: http://jes.blogs.shellprompt.net
Work: http://www.apex-evangelists.com
Author of Pro Application Express: http://tinyurl.com/3gu7cd
REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!
Similar Messages
-
Displaying Images stored in Database
Hi, all i am having images stored in Databases as BLOB.
how i can display that in flex application. suppose i am having the ArrayList of Employees in which employee object also have a field of called empImage, how i can display this data in flex.
i am using BlazeDS.
Thanks
Regards
Amar Deep SinghHi,
This will give you the idea of getting the image from you array list.
http://blog.flexexamples.com/2008/02/15/creating-a-simple-image-gallery-with-the-flex-hori zontallist-control/
Johnny
Please rate my answer. Tks -
Getting image stored in database !!
Hey !!
I'm really trying to solve so much problems i'm having with javafx !!
So, like the title may suggest, i'm having problems as to get image from the database !!
Everything seems fine but it tells me that there is "Exception while runing Application"
here is the code !!
@James D, i will come back bugging yu again to see how to use the stored images and display them inside the combobox and to render them ^^
I haven't well understand how well as to use the enum struc in which yu declared the composed <Image,String> type ^^
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javafx.application.Application;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javax.swing.JOptionPane;
* @author Minedun6
public class DynamicCustomComboBox extends Application {
Connection c = connection.ConnecrDb();
PreparedStatement pst = null;
ResultSet rs = null;
ComboBox box1;
ImageView view;
@Override
public void start(Stage primaryStage) {
box1 = new ComboBox();
box1.setPrefSize(100, 25);
box1.setOnShowing(new EventHandler() {
@Override
public void handle(Event t) {
box1.getItems().clear();
try {
String sql = "select libelle_constr,img_constructeur from constructeurs where libelle_constr='Citroen';";
pst = c.prepareStatement(sql);
rs = pst.executeQuery();
while(rs.next()){
box1.getItems().add(rs.getString("libelle_constr"));
InputStream input = new ByteArrayInputStream(rs.getBytes("img_constructeur"));
Image imge = new Image(input);
view.setImage(imge);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
StackPane root = new StackPane();
root.getChildren().addAll(box1);
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
public static void main(String[] args) {
launch(args);
}In any real application, it's a mistake to mix your presentation (user interface) code with your persistance (database access) code.
Why? You want maintainability, flexibility, and testability.
Maintainability:
Suppose you want to change the structure of your database. E.g. the database admin (which may be you, or someone else) determines that the database design you have is inefficient and needs to be changed. If your database code is scattered over the whole application, mixed in among your user interface code, tracking down what needs to be changed will be a nightmare. If all your database code is in a single class, or perhaps a set of classes in a single package, then the updates are localized and much easier to manage. Furthermore, you can build the new database access code on its own, test it out, and then when you are sure it works just switch your user interface code to use the new persistance layer instead of the old one. The same applies if you decide you're going to use a completely different technology to store the data; perhaps you want to use something like Hibernate instead of plain JDBC, or maybe you decide you want to make the data accessibile via a web service.
Flexibility:
What if you (or, more likely, your manager) decides they're going to change to a new user interface technology. Maybe they decide to switch to a web application (i.e. HTML-based) instead of a desktop application. You obviously need to rewrite the user interface code, but you should be able to keep all the database access code you've written. If your database access code is all jumbled up with the user interface code you're replacing, it's going to be way harder to reuse that code. If the two are separated out, you just build a new user interface in whatever new technology you're using, and access the same class(es) you used for your database access without touching them.
Testability:
This whole thread is actually a demo of how testability is much harder if you don't properly separate your code. You posted "getting image stored in database", thinking that was your problem. It wasn't; your problem was actually an error in the way you'd set up your JavaFX code. Because the two were completely mixed together, it was hard to know where the error was. The error you had was actually a really simple one; it would have been much easier to see if you had simpler, properly separated code; but because you didn't organize your code like that it took you days to figure out the problem. This was only a couple of dozen lines of code; imagine how this looks in a real application with hundreds or thousands of classes.
The point is that decisions about how to access your data (standalone database, web service, or EJB?; plain JDBC, JPA, Hibernate, etc?) , and decisions about the presentation technology (desktop or web? JavaFX or Swing?, or Servlets/JSPs, JSF, Swing MVC, or any of a huge number of frameworks) are completely independent. You should be in a position to change those decisions - to redesign aspects of the application - with the least amount of effort possible. Failing to properly design things will make this much harder, or likely completely impossible.
These are real concerns that affect every application that goes into production.
Even if you're just making a small application, it will benefit you to set things up correctly from the outset. -
Printing intermediate object (images) stored in an internal table
Hi All,
I'm fetching certain imgaes / documents from a 3rd party repository system (IXOS) and storing the objects in an internal table in a program, later to download them onto the Presentation Server through an ABAP Program.
But instead of downloading these images onto the Presentation Server, i want to directly print them through the ABAP Program on the local printer.
These images are stored in some raw format in the internal table.
Is there any way in which these N images or N raw data sets can be converted into N separate spools so that spools can be converted into N PDFs and then printed?
Or is there any other way in which i can print these N images directly from the ABAP report.
Request your help.
Many thanks in advance,
SGNot so easy. You can't just take an image in any format directly into a spool, SAP is only able to print TIFFs and BMPs (and not all "sub-formats") into spools.
You first need to know what image formats you have to print, to make sure you're able to process all of these formats.
You may try to use OLE technology to embed the image into a Word document for example, and print this document. -
Showing Image Stored In DataBase
Hello Friends,
I have images stored in MySQL database. In a blob field. In a desktop application i have used
blob b=rs.getBlob("Picture");
byte[] buf=b.getBytes((long)1,(int)b.length());
ImageIcon imgIcon= new ImageIcon(buf);
Image img=imgIcon.getImage();
Graphics g=image.getGraphics();
g.drawImage(img,0,0,320,240,image);
the thing worked fine. But now i have to show images over web. I am not able to uderstand that how to show images. As i m unable to get Graphics from any of the component.
Help Me,
Its urgent,
thanking u all
Abhilash JainThe common method to include binary information (image, PDF, document, etc) is to Base64 encode the file and store the resulting character string in the XML. It would be up to the receiving system to handle the encoded information in the XML.
-
Showing image stored in database to XML file
Hi
I have an employee portal from where i can take a report of the employee profile .All the details of the employees are in the table.I am storing the image of the employee as BLOB in the table.
How will i show the image file in my XML file.
Thanks in advance.
SRIThe common method to include binary information (image, PDF, document, etc) is to Base64 encode the file and store the resulting character string in the XML. It would be up to the receiving system to handle the encoded information in the XML.
-
Serving webpage with image stored in database
This may look long, but it's easy to understand--I'm just trying to give all the details you might want: In our servlet/JSP site, a user can generate a report that may or may not contain images. The servlet just sends the user to a regular HTML page. The HTML file and images it may have are stored in directories on the Tomcat server. But now we have a problem...
We're moving to 2 standalone Tomcat machines with a load balancer in front, and so now we want to move any of this stuff that was stored on the webserver into the database. If the HTML text for the report has not yet been generated for that day, I can see my web app going to the database to pull out that HTML, and if there are any images, it could pull those out of the database, but then...how does it get those to the user's web browser?
Currently, when this report loads in the browser, we do a sendRedirect to the file, and the URL displays the full path to the file (and in the HTML code, there is of course a relative link to the image file). But now, these are supposed to be pulled out of the database...are we going to have to pull them out of the database and then write them out to file on the webserver (since they might not exist on that webserver), or is there some other/better way to display them to the user?
Thanks...You can create an Image Servlet that you use to stream the image streight from the db to the page. The URLs that you use in the HTML pages would point to this Servlet with a parameter identifying the image (or you could map the Servlet to *.gif for example). The servlet then sets the content type to the appropriate image format, retrieves the image from the DB as a Stream and copies it byte for byte to the response output stream.
If you search the forums you will probably find an example of how to do this. -
How to access images stored in database using forms
i have created a table which stores images in bfile type
i would like to access the images along with other data
stored in forms.iam not able to get the image using select statement.could anyone tell me the format using which i would be able to access the image.in my impression, Oracle's samples store the BFILE images off line though if I did not remember wrong.
If you can create a form type form using form wizard based on that image table, then you may execute query to view the image. But SELECT ... INTO will not work for LOBs on form.
If off line in file system, you may try to READ_IMAGE_FILE(). -
How to fetch images stored in database to reports
i have stored images in bfile type.i need to access the image.pls do inform me urgently.
Hi,
Follow the steps to access images using Reports.
1. create the sql query in datamodel editor.
2. Open property inspector for Bfile column
3. Set file format property to Image.
4. Goto Report's layout editor
5. Create field and required frames, set field's source to BFILE column name.
6. Now run the report
Thanks,
Oracle Reports Team. -
Can XML Publisher create a report that contains an image that is retrieved from the database in an intermedia type column, or must the image reside on the hard drive?
Hi,
This will give you the idea of getting the image from you array list.
http://blog.flexexamples.com/2008/02/15/creating-a-simple-image-gallery-with-the-flex-hori zontallist-control/
Johnny
Please rate my answer. Tks -
Display images stored in the database
I have images stored in the databse. I followed the steps provided in the oracle documentation. Now i want to retrive the image from the database into a java object that can be dislayed in , say, a JLabel. I am able to retrieve the image from the database into the OrdImage in the oracle.java.ord package and view the properties of the image. But unable to retrive the image as such to be displayed.
Thanking You
vinayThis might help...
import javax.imageio.*;
import javax.imageio.stream.*;
import javax.swing.*;
import java.awt.*;
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
import oracle.sql.* ;
import oracle.ord.im.*;
import java.awt.event.*;
public class HelloDBImage implements ActionListener{
OracleConnection con = null;
JLabel label = null;
String textFieldString = "Image ID entered";
public void actionPerformed(ActionEvent e)
String prefix = "You typed \"";
if (e.getActionCommand().equals(textFieldString))
JTextField source = (JTextField)e.getSource();
ImageIcon imgIcon = createImageIcon(source.getText());
if (null != imgIcon)
// Create image Label
label.setText(null);
label.setIcon(imgIcon);
else
label.setIcon(null);
label.setText("Image not found! ");
source.setText("");
label.repaint();
//actionLabel.setText(prefix + source.getText() + "\"");
public ImageIcon createImageIcon(String key)
Image image = null;
ImageIcon imgIcon = null;
try
// Connect to the database if necessary
if (null == con) con = connect();
// Create Input Stream from DB image.
InputStream is = new BufferedInputStream(
getDBInputStream(con, key));
if (null != is)
// Create Image from Image Input Stream
ImageInputStream iis = ImageIO.createImageInputStream(is);
image = ImageIO.read(iis);
// Create Image Icon from ImageInputStream
if (null != image) imgIcon = new ImageIcon(image);
} catch (Exception e)
System.out.println("exception raised " + e);
e.printStackTrace();
return imgIcon;
public Component createPanelAndContents(String key)
// Create the image label
ImageIcon imgIcon = createImageIcon(key);
if (null != imgIcon)
// Create image Label
label = new JLabel(imgIcon);
else
label = new JLabel("Image not found! ");
// Create layout
GridBagLayout gridBag = new GridBagLayout();
// Create panel to draw in
JPanel pane = new JPanel();
pane.setLayout(gridBag);
GridBagConstraints c = new GridBagConstraints();
JScrollPane scrollPane = new JScrollPane(label,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
c.fill = GridBagConstraints.BOTH;
c.weightx = 1.0;
c.weighty = 1.0;
gridBag.setConstraints(scrollPane, c);
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.HORIZONTAL;
scrollPane.setMinimumSize(new Dimension(300, 300));
pane.add(scrollPane, c);
// Add a text field and label to get anoter image
JTextField textField = new JTextField(10);
textField.setActionCommand(textFieldString);
textField.addActionListener(this);
// Add fields for input
JLabel promptLabel = new JLabel("Please enter DB key: ");
pane.add(promptLabel);
pane.add(textField, c);
return pane;
public static void main(String[] args)
String key = "1";
try
UIManager.setLookAndFeel(
UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) { }
//Create the top-level container and add contents to it.
JFrame frame = new JFrame("SwingApplication");
HelloDBImage app = new HelloDBImage();
if ((args.length > 0) && (args[0] != null)) key = args[0];
System.out.print("length= " + args.length + "/" );
if (args.length > 0) System.out.println(args[0]);
Component contents = app.createPanelAndContents(key);
frame.getContentPane().add(contents, BorderLayout.CENTER);
//Finish setting up the frame, and show it.
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
frame.pack();
frame.setVisible(true);
public InputStream getDBInputStream(OracleConnection con, String key)
InputStream is = null;
try
int index = 0;
Statement s = con.createStatement();
OracleResultSet rs =
(OracleResultSet)s.executeQuery("select * from images " +
"where item_id = " + key );
if (rs.next()) // Just get first image if more than 1.
index = rs.getInt(1);
OrdImage imgObj =
(OrdImage) rs.getCustomDatum(2, OrdImage.getFactory());
is = imgObj.getContent().getBinaryStream();
catch(Exception e)
System.out.println("exception raised " + e);
e.printStackTrace();
return is;
public OracleConnection connect() throws Exception
String connectString;
Class.forName ("oracle.jdbc.driver.OracleDriver");
connectString = "jdbc:oracle:oci8:@orcl";
OracleConnection con = (OracleConnection)
DriverManager.getConnection(connectString,"scott",
"tiger");
con.setAutoCommit(false);
return con; -
Retrieving an image from the database and printing it
Can anybody help please
i dont know how to retreive an image from a image database and send to the printer.
The image is stored in the database in cells ( not as a path to a file).Hi,
I want to print a gif image.
How can i get this done?
I am trying graphicsobject.drawImage(....),it prints the image only once.If i try second time the image wont be printed,where as if i switch off and then switch on the printer and try again ,then it will print.I am facing the same problem with a HP Laser Jet as well as a thermal Printer.Actually i want to print a bar code.
some body pls help me to sort this issue.
Regards,
ciju
[email protected] -
Display PDF Documents Stored In Database
Hi
I apologise that this question has been asked many times, but I just do not seem to be able to find answer to my question in many other posts over the years.
We have pdf documents stored in database and wish for client to view from forms session.
I am able to use webutil_file_transfer.DB_To_Client_With_Progress to transfer to client and open using client_host('cmd /c start '||TheFile);
I am also able to view pdf documents stored on application server using web.show_document.
What I would prefer to do is:
1. Transfer file from database to application server (This is bit I cannot figure out)
2. Display from application server using web.show_document
3. Delete temporary file from application server (Also unsure how to do this)
Our users have thin clients and so in many cases do not have access or unsure where can access to store temporary file if use transfer to client method. Wish to keep temporary file activity on application server.You can combine the methods in WEBUTIL. Check this Re: Forms 10G - Saving Blob on Application Server using Java.
-
Problem regarding PDF printing in apex 3.1 and 11g database using cocoon
Hi,
i am configuring pdf printing on apex 3.1 (database 11g on windows XP OS) with cocoon/apache tomcat/fop using steps given in Carl Backstrom blog
http://carlback.blogspot.com/2007/03/apex-cocoon-pdf-and-more.html
I am using cocoon 2.2.10 / tomcat 6.0.20 and JDK 1.6
I did everything as was mentioned in Carl's blog and everything configured without any hassle. I even enabled network services for FLOWS_030100 user on database. Even after doing all the steps I'm getting the error
ORA-20001: The printing engine could not be reached because either the URL specified is incorrect or a proxy URL needs to be specified.
I'm confused and don't know what to do next.Hi,
By default, the ability to interact with network services is disabled in Oracle Database 11g release 1 (11.1). Therefore, if running Oracle Application Express with Oracle Database 11g release 1 (11.1), use the new DBMS_NETWORK_ACL_ADMIN package to grant connect privileges to any host for the FLOWS_030100 database user. Failing to grant these privileges results in issues with PDF/report printing, specifically, you will get the following error message:
ORA-20001: The printing engine could not be reached because either
the URL specified is incorrect or a proxy URL needs to be specified.
Follow the steps mentioned in the Oracle Application Express Installation Guide, [Enabling Network Services in Oracle Database11g|http://download.oracle.com/docs/cd/E10513_01/doc/install.310/e10496/post_inst.htm#BGEJJIHE]. Also refer to the [troubleshooting section|http://download.oracle.com/docs/cd/E10513_01/doc/install.310/e10496/post_inst.htm#BHAGIHIB] in case you receive an ORA-44416: Invalid ACL error after running the previous script.
/Kenny -
Reader prints pdf file in mirror image, can't set off as a default that holds.
reader prin
ts pdf file in mirror image, can't set
off in advanced printer preferences as the default,
has to be turned off each time4 manually.Same here using Adobe 9.3.2 this appears to be an adobe latest version programming issue. Can workaround by manually resetting before printing but that is not the point. Many others on here with same prob. Is there a fix?
Maybe you are looking for
-
Unable to browse the hypertext in the upper part of a website by using Firefox
I can't browse the hypertext in the upper part of a website by using Firefox. For example, in the website of Firefox, the cursor fails to change from 'arrow' to 'hand' when I point to 'Sign Out' or 'Inbox'. But it's ok for the remaining part of the w
-
Issue with F110 - FREE SELECTION TAB.
Hi All, I am facing one problem for updating the FREE SELECTION TAB for FIELD NAME and its corresponding value. For this update I am using BDC. If I create the proposal manually then the values get display after saving the proposal entry. But if I do
-
What are the alternatives to updating indicators using property nodes?
Hello, I'm building a VI which needs to update several controls/indicators at multiple points throughout its execution. It also needs to be able to accept new values from the controls at any given time. The problem with this is that all of these cont
-
I've had the RAZR about 3 weeks. I setup my work e-mail under the MAIL app and it worked fine until today when I had to change my password. Then I got a "Could not connect to server". Since Google (GMAIL) is our service provider someone here t
-
How to modify CRT currency field
Hi all, i am new to ABAP HR so please help me. i am trying to modify the CRT internal table when run the payroll. the situation is that we have a company code currency in SAR and there is an employee who gets the currency in USD. I have to store the