4.1 KiB
4.1 KiB
DFD.html to PNG Conversion Guide
Overview
This document provides instructions for converting the DFD.html file to a PNG image.
File Information
- Input file:
/Users/home/YandexDisk/TECHNOLYCEUM/ict/Year/2025/ai/ai7/ai7-m3/Thesis materials/DFD.html - Expected output:
DFD.pngin the same directory
Method 1: Using Command Line Tools
Option A: Using wkhtmltopdf
-
Install wkhtmltopdf:
# On macOS brew install wkhtmltopdf # On Ubuntu/Debian sudo apt-get install wkhtmltopdf -
Convert HTML to PNG:
wkhtmltoimage --width 1200 --height 800 "/Users/home/YandexDisk/TECHNOLYCEUM/ict/Year/2025/ai/ai7/ai7-m3/Thesis materials/DFD.html" "/Users/home/YandexDisk/TECHNOLYCEUM/ict/Year/2025/ai/ai7/ai7-m3/Thesis materials/DFD.png"
Option B: Using Puppeteer (Node.js)
-
Install Node.js and npm if not already installed
-
Install Puppeteer:
npm install puppeteer -
Create a conversion script:
const puppeteer = require('puppeteer'); const fs = require('fs'); (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); // Read the HTML file const htmlContent = fs.readFileSync('/Users/home/YandexDisk/TECHNOLYCEUM/ict/Year/2025/ai/ai7/ai7-m3/Thesis materials/DFD.html', 'utf8'); await page.setContent(htmlContent); // Take screenshot await page.screenshot({ path: '/Users/home/YandexDisk/TECHNOLYCEUM/ict/Year/2025/ai/ai7/ai7-m3/Thesis materials/DFD.png', fullPage: true }); await browser.close(); console.log('Conversion completed!'); })();
Method 2: Using Python Libraries
Option A: Using Selenium
-
Install required packages:
pip install selenium -
Make sure you have ChromeDriver installed
-
Run the following script:
from selenium import webdriver from selenium.webdriver.chrome.options import Options import os # Setup Chrome options chrome_options = Options() chrome_options.add_argument("--headless") # Run in background chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--disable-dev-shm-usage") # Initialize the driver driver = webdriver.Chrome(options=chrome_options) # Load the HTML file file_url = "file://" + os.path.abspath("/Users/home/YandexDisk/TECHNOLYCEUM/ict/Year/2025/ai/ai7/ai7-m3/Thesis materials/DFD.html") driver.get(file_url) # Set window size and take screenshot driver.set_window_size(1200, 800) driver.save_screenshot("/Users/home/YandexDisk/TECHNOLYCEUM/ict/Year/2025/ai/ai7/ai7-m3/Thesis materials/DFD.png") driver.quit() print("Conversion completed!")
Option B: Using Playwright
-
Install required packages:
pip install playwright playwright install chromium -
Run the following script:
from playwright.sync_api import sync_playwright import os with sync_playwright() as p: browser = p.chromium.launch(headless=True) page = browser.new_page() # Load the HTML file file_path = os.path.abspath("/Users/home/YandexDisk/TECHNOLYCEUM/ict/Year/2025/ai/ai7/ai7-m3/Thesis materials/DFD.html") page.goto(f"file://{file_path}") # Set viewport size and take screenshot page.set_viewport_size({"width": 1200, "height": 800}) page.screenshot(path="/Users/home/YandexDisk/TECHNOLYCEUM/ict/Year/2025/ai/ai7/ai7-m3/Thesis materials/DFD.png", full_page=True) browser.close() print("Conversion completed!")
Method 3: Manual Conversion
- Open the DFD.html file in your web browser
- Take a screenshot of the page (using Cmd+Shift+4 on macOS or PrtScn on Windows)
- Crop the screenshot to include only the relevant content
- Save the image as DFD.png in the Thesis materials directory
Verification
After conversion, verify that:
- The PNG file exists in the Thesis materials directory
- The image clearly displays the content from the DFD.html file
- The image quality is sufficient for your needs