Gabriel Cristian Ditu wrote:
Indeed, I noted that line width has a float value, however something
like this (which is what I need)
cb.setLineWidth(0.25f);
still produces a line of width 1pt in the PDF document. I wonder if I
am doing something wrong?
Maybe you set the line width after you stroke the line
or maybe you change the line width to something else
before you stroke the line with that line width.
Would it be possible for someone to post a snippet of code that
produces a line of width 0.25pt? It would be much appreciated.
This example works for me on the screen, but if I print the doc, there
is little difference between the lines with width 0.1, 0.2 and 0.3;
there is however a difference between the line with width 0.3 and 0.4:
public static void main(String[] args) {
System.out.println("Chapter 8: example DrawLines");
System.out.println("-> Creates a PDF file with lines that have a
different width.");
System.out.println("-> jars needed: iText.jar");
// step 1: creation of a document-object
Document.compress = false;
Document document = new Document(PageSize.A4);
try {
// step 2:
// we create a writer
PdfWriter writer = PdfWriter.getInstance(
// that listens to the document
document,
// and directs a PDF-stream to a file
new FileOutputStream("DrawLines.pdf"));
// step 3: we open the document
document.open();
// step 4: we add a paragraph to the document
PdfContentByte cb = writer.getDirectContent();
BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA,
BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
for (int i = 30; i > 0; i--) {
System.err.println((float)i / 10);
cb.setLineWidth((float)i / 10);
cb.moveTo(36, 806 - (5 * i));
cb.lineTo(400, 806 - (5 * i));
cb.stroke();
}
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
// step 5: we close the document
document.close();
}
I think what I am trying to do is increase the resolution. The
72pt/inch default is not fine enough for my needs. Is there a way of
doing this?
Since PDF 1.6 you can change the user unit, but that won't be necessary.
br,
Bruno
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions