🎉 Before you dive into this article...
🚀 Check out our vibrant new community at CoderLegion.com!
💡 Share your knowledge, connect with like-minded developers, and grow together.
👉 Click here to join now!
Navigate to the \ "Download iText \" link in the Resources section below and click on \ "Download iText-5.0.1.jar \". Remember the location of the \ ". Jar \" downloaded file.
Eclipse open. Go to \ "File \" \ "New, \" \ "Java Project, \" type \ "MyPdfReader \" as the project name and click \ "Finish. \"
Second, click on \ "MyPdfReader \" in Package Explorer (the toolbar on the left side) and select "Properties . \"
Click the \ "Java Build Path \" on the left and then under the \ "Libraries \" tab on the right, click the \ "Add external JARs ... \" button. Navigate to the \ ". Jar \" file that you downloaded in step 1 and click \ "OK \". The iText library has already been activated in your Java Project. We are going to use your PdfReader to read PDF files.
Second click on the MyPdfReader folder on the right and select \ "New, \" \ "Class. \" Call it \ "ReadPdf \" and select the \ "create public void method \" checkbox and click \ "To accept . \ "
Select the blank space above \ "ReadPdf public class {\" and enter the following code:
import java.io.FileOutputStream
IR
com.itextpdf.text import.
GO import com.itextpdf.text.pdf .;
Select the blank space in \ "main (String args []) public void {\" and type the following line:
PdfReader reader = new PdfReader (\ "HelloWorldPdf.pdf \")
GO
This line of code is read in the PDF is located inside the project folder (in this case, HelloWorldPdf.pdf is a test PDF file). After reading the PDF file, you have access to the PDF properties such as its height and width.
Under the line \ "PdfReader reader = new PdfReader (\" HelloWorldPdf.pdf \ "); \" enter the following code:
int n = reader.getNumberOfPages();
Rectangle psize = reader.getPageSize(1)
TO GO
float width = psize.height()
TO GO
float height = psize.width()
TO GO
The variable \ "n \" now contains the number of pages of the sample pdf and the variables \ "width \" and \ "height \" contain their dimensions.
Set text color in HTML
Adding color to your HTML text is easy! In this short tutorial we will see how to change the color of your HTML text with Hex color codes, HTML color names, RGB and HSL values.
Text color with Hex color codes
The most common way to color HTML text is by using Hex color codes (Hex code for short). Just add a style attribute to the text element you want to color - a paragraph in the example below - and use the color property with its Hex encoding.
Text color with HTML color names
Another way to color text on your website is by using an HTML color name. The HTML code is similar, just replace the Hex code in the previous step with the name of the color you want to use (red in our example).
Text color using RGB color values
Using RGB values is all the rage these days, but it's as easy as Hex codes or color names. Enter the RGB values in the rgb () parameter after the color property. You can use our color table to get the RGB values in addition to the Hex codes.
When using an RGB value on your website, you can also specify the opacity. Instead of rgb () use rgba () - the a is for alpha, the color channel that controls the opacity, and after your three color values add a quarter opacity, on a scale of 0 - 1 (0 for fully transparent, 1 for fully opaque).
Text color using HSL color values
A fourth method of adding HSL color is through values. Similar to the RGB syntax described above, HSL uses the hsl () prefix and three values for hue, saturation, and lightness. Hue is represented on a scale from 0 to 360, while saturation and lightness are a percentage between 0 and 100
Just like RGB, when using HSL you can modify the opacity of the color just in the color property. Use the prefix hsla () and include a fourth value between 0 and 1 for the level of opacity you need.
Top comments (0)