uploaded new name

This commit is contained in:
2025-09-22 20:34:15 +03:00
parent dd1772222d
commit 921ea43834
14 changed files with 180 additions and 64 deletions

View File

@@ -999,7 +999,7 @@ def create_extension_package():
files_added += 1 files_added += 1
# Add a README file with installation instructions # Add a README file with installation instructions
readme_content = """# Quality Recticel Print Helper Chrome Extension readme_content = """# Quality Label Printing Helper Chrome Extension
## Installation Instructions: ## Installation Instructions:
@@ -1011,7 +1011,7 @@ def create_extension_package():
## Usage: ## Usage:
1. Go to the Print Module in the Quality Recticel application 1. Go to the Print Module in the Quality Label Printing application
2. Select an order from the table 2. Select an order from the table
3. Click the "🖨️ Print Direct" button 3. Click the "🖨️ Print Direct" button
4. The label will print automatically to your default printer 4. The label will print automatically to your default printer
@@ -1083,7 +1083,7 @@ def create_service_package():
static_dir = os.path.join(current_app.root_path, 'static') static_dir = os.path.join(current_app.root_path, 'static')
os.makedirs(static_dir, exist_ok=True) os.makedirs(static_dir, exist_ok=True)
zip_filename = 'quality_recticel_print_service.zip' zip_filename = 'quality_label_printing_service.zip'
zip_path = os.path.join(static_dir, zip_filename) zip_path = os.path.join(static_dir, zip_filename)
# Create ZIP file with Windows service package # Create ZIP file with Windows service package
@@ -1109,7 +1109,7 @@ def create_service_package():
files_added += 1 files_added += 1
# Add installation instructions for native PowerShell solution # Add installation instructions for native PowerShell solution
installation_readme = """# Quality Recticel Windows Print Service - Native Edition installation_readme = """# Quality Label Printing Windows Service - Native Edition
## INSTALLATION INSTRUCTIONS (Native PowerShell - Zero Dependencies!) ## INSTALLATION INSTRUCTIONS (Native PowerShell - Zero Dependencies!)

View File

@@ -617,25 +617,37 @@ async function checkPrintServiceAvailability() {
try { try {
printerStatus.textContent = 'Checking Windows Print Service...'; printerStatus.textContent = 'Checking Windows Print Service...';
console.log(`🔍 Checking Windows Print Service at: ${PRINT_SERVICE_URL}/health`);
const response = await fetch(`${PRINT_SERVICE_URL}/health`, { const response = await fetch(`${PRINT_SERVICE_URL}/health`, {
method: 'GET', method: 'GET',
signal: AbortSignal.timeout(3000) signal: AbortSignal.timeout(5000)
}); });
console.log(`📡 Service response status: ${response.status}`);
if (response.ok) { if (response.ok) {
const data = await response.json();
console.log('📋 Service response data:', data);
printServiceAvailable = true; printServiceAvailable = true;
console.log('✅ Windows Print Service is available'); console.log('✅ Windows Print Service is available and responding!');
updatePrintButtonForService(true); updatePrintButtonForService(true);
updatePrinterStatus(`Windows Print Service detected (${data.platform || 'Unknown platform'})`);
await loadAvailablePrinters(); await loadAvailablePrinters();
} else { } else {
throw new Error('Service not responding'); throw new Error(`Service responded with status ${response.status}`);
} }
} catch (error) { } catch (error) {
printServiceAvailable = false; printServiceAvailable = false;
console.log('⚠️ Windows Print Service not available, using fallback PDF download'); console.error(' Windows Print Service check failed:', error);
console.log(`🔧 Troubleshooting:
1. Is the service running? Check: sc query QualityLabelPrinting
2. Is port 8765 accessible? Try: http://localhost:8765/health in new tab
3. Service logs: C:\\Program Files\\QualityLabelPrinting\\PrintService\\print_service.log`);
updatePrintButtonForService(false); updatePrintButtonForService(false);
updatePrinterStatus('Windows Print Service not detected - PDF download mode'); updatePrinterStatus(`Windows Print Service not detected - ${error.message}`);
} }
} }
@@ -710,12 +722,16 @@ function updatePrintButtonForService(serviceAvailable) {
// Enhanced print function with Windows service support // Enhanced print function with Windows service support
async function printLabelsWithService(orderId, prodOrder, quantity) { async function printLabelsWithService(orderId, prodOrder, quantity) {
console.log(`🖨️ printLabelsWithService called - Order: ${orderId}, Quantity: ${quantity}`);
try { try {
// Generate PDF URL // Generate PDF URL
const pdfUrl = `${window.location.origin}/generate_labels_pdf/${orderId}`; const pdfUrl = `${window.location.origin}/generate_labels_pdf/${orderId}`;
console.log(`📄 PDF URL: ${pdfUrl}`);
// Get selected printer from dropdown // Get selected printer from dropdown
const selectedPrinter = getSelectedPrinter(); const selectedPrinter = getSelectedPrinter();
console.log(`🖨️ Selected printer: ${selectedPrinter}`);
// Prepare print data for service // Prepare print data for service
const printData = { const printData = {
@@ -727,6 +743,9 @@ async function printLabelsWithService(orderId, prodOrder, quantity) {
quantity: quantity quantity: quantity
}; };
console.log('📋 Print request data:', printData);
console.log(`📡 Sending to: ${PRINT_SERVICE_URL}/print/silent`);
// Send to Windows service // Send to Windows service
const response = await fetch(`${PRINT_SERVICE_URL}/print/silent`, { const response = await fetch(`${PRINT_SERVICE_URL}/print/silent`, {
method: 'POST', method: 'POST',
@@ -736,11 +755,16 @@ async function printLabelsWithService(orderId, prodOrder, quantity) {
body: JSON.stringify(printData) body: JSON.stringify(printData)
}); });
console.log(`📨 Service response status: ${response.status}`);
const result = await response.json(); const result = await response.json();
console.log('📋 Service response data:', result);
if (response.ok && result.success) { if (response.ok && result.success) {
// Success - labels printed silently // Success - labels printed silently
const printerName = selectedPrinter === 'default' ? 'default printer' : selectedPrinter; const printerName = selectedPrinter === 'default' ? 'default printer' : selectedPrinter;
console.log(`✅ Print successful to printer: ${printerName}`);
alert(`✅ Labels printed successfully!\n\n📊 Order: ${prodOrder}\n📦 Quantity: ${quantity} labels\n🖨️ Printer: ${printerName}\n📋 Sequential: ${prodOrder}-001 to ${prodOrder}-${String(quantity).padStart(3, '0')}\n\n🎯 Printed silently via Windows service!`); alert(`✅ Labels printed successfully!\n\n📊 Order: ${prodOrder}\n📦 Quantity: ${quantity} labels\n🖨️ Printer: ${printerName}\n📋 Sequential: ${prodOrder}-001 to ${prodOrder}-${String(quantity).padStart(3, '0')}\n\n🎯 Printed silently via Windows service!`);
// Update order status in database // Update order status in database
@@ -748,11 +772,12 @@ async function printLabelsWithService(orderId, prodOrder, quantity) {
return true; return true;
} else { } else {
throw new Error(result.error || 'Print service failed'); console.error('❌ Service returned error:', result);
throw new Error(result.error || `Print service failed with status ${response.status}`);
} }
} catch (error) { } catch (error) {
console.error('Windows service print error:', error); console.error('Windows service print error:', error);
throw error; throw error;
} }
} }
@@ -854,20 +879,29 @@ function addPDFGenerationHandler() {
try { try {
let success = false; let success = false;
console.log(`🖨️ Print operation started - Service available: ${printServiceAvailable}`);
// Try Windows service first if available // Try Windows service first if available
if (printServiceAvailable) { if (printServiceAvailable) {
console.log('🚀 Attempting silent print via Windows service...');
try { try {
success = await printLabelsWithService(orderId, prodOrder, quantity); success = await printLabelsWithService(orderId, prodOrder, quantity);
console.log(`✅ Windows service print result: ${success}`);
} catch (serviceError) { } catch (serviceError) {
console.warn('Windows service failed, falling back to PDF download:', serviceError); console.error('Windows service failed:', serviceError);
console.warn('🔄 Falling back to PDF download mode');
printServiceAvailable = false; // Mark as unavailable for this session printServiceAvailable = false; // Mark as unavailable for this session
updatePrintButtonForService(false); updatePrintButtonForService(false);
} }
} else {
console.log('📄 Service not available, using PDF download mode');
} }
// Fallback to PDF download if service failed or unavailable // Fallback to PDF download if service failed or unavailable
if (!success) { if (!success) {
console.log('📥 Generating PDF for download...');
success = await downloadPDFLabels(orderId, prodOrder, quantity); success = await downloadPDFLabels(orderId, prodOrder, quantity);
console.log(`📄 PDF download result: ${success}`);
} }
} catch (error) { } catch (error) {

View File

@@ -1,5 +1,5 @@
/** /**
* Quality Recticel Print Service - Background Script * Quality Label Printing Service - Background Script
* Handles communication between web pages and Windows print service * Handles communication between web pages and Windows print service
*/ */
@@ -16,7 +16,7 @@ let serviceStatus = {
// Initialize extension // Initialize extension
chrome.runtime.onInstalled.addListener(() => { chrome.runtime.onInstalled.addListener(() => {
console.log('Quality Recticel Print Service extension installed'); console.log('Quality Label Printing Service extension installed');
checkServiceStatus(); checkServiceStatus();
// Set up periodic service check // Set up periodic service check
@@ -160,7 +160,7 @@ async function handlePrintPDF(printData) {
chrome.notifications.create({ chrome.notifications.create({
type: 'basic', type: 'basic',
iconUrl: 'icons/icon48.png', iconUrl: 'icons/icon48.png',
title: 'Quality Recticel Print Service', title: 'Quality Label Printing Service',
message: 'PDF printed successfully' message: 'PDF printed successfully'
}); });
@@ -176,7 +176,7 @@ async function handlePrintPDF(printData) {
chrome.notifications.create({ chrome.notifications.create({
type: 'basic', type: 'basic',
iconUrl: 'icons/icon48.png', iconUrl: 'icons/icon48.png',
title: 'Quality Recticel Print Service', title: 'Quality Label Printing Service',
message: `Print failed: ${error.message}` message: `Print failed: ${error.message}`
}); });

View File

@@ -1,9 +1,9 @@
/** /**
* Quality Recticel Print Service - Content Script * Quality Label Printing Service - Content Script
* Injects print service functionality into web pages * Injects print service functionality into web pages
*/ */
// Only inject on Quality Recticel domains or localhost // Only inject on Quality Label Printing domains or localhost
const allowedDomains = [ const allowedDomains = [
'localhost', 'localhost',
'127.0.0.1' '127.0.0.1'
@@ -11,11 +11,11 @@ const allowedDomains = [
const currentDomain = window.location.hostname; const currentDomain = window.location.hostname;
if (!allowedDomains.includes(currentDomain)) { if (!allowedDomains.includes(currentDomain)) {
console.log('Quality Recticel Print Service: Not injecting on', currentDomain); console.log('Quality Label Printing Service: Not injecting on', currentDomain);
// return; // Commented out for development - remove in production // return; // Commented out for development - remove in production
} }
console.log('Quality Recticel Print Service: Content script loaded'); console.log('Quality Label Printing Service: Content script loaded');
// Inject print service API into the page // Inject print service API into the page
const printServiceAPI = { const printServiceAPI = {
@@ -87,7 +87,7 @@ const printServiceAPI = {
}, },
/** /**
* Print labels with Quality Recticel specific formatting * Print labels with Quality Label Printing specific formatting
*/ */
async printLabels(orderData, quantity = 1) { async printLabels(orderData, quantity = 1) {
try { try {
@@ -118,10 +118,10 @@ window.QualityRecticelPrintService = printServiceAPI;
// Inject into page context for better compatibility // Inject into page context for better compatibility
const script = document.createElement('script'); const script = document.createElement('script');
script.textContent = ` script.textContent = `
// Quality Recticel Print Service API // Quality Label Printing Service API
window.QualityRecticelPrintService = ${JSON.stringify(printServiceAPI)}; window.QualityRecticelPrintService = ${JSON.stringify(printServiceAPI)};
// Enhanced print function for Quality Recticel // Enhanced print function for Quality Label Printing
window.printQualityRecticelLabels = async function(orderData, quantity) { window.printQualityRecticelLabels = async function(orderData, quantity) {
try { try {
// Get the PDF blob from the server // Get the PDF blob from the server
@@ -173,12 +173,12 @@ script.textContent = `
}); });
} catch (error) { } catch (error) {
console.error('Print Quality Recticel labels error:', error); console.error('Print Quality Label Printing labels error:', error);
return { success: false, error: error.message }; return { success: false, error: error.message };
} }
}; };
console.log('Quality Recticel Print Service API injected'); console.log('Quality Label Printing Service API injected');
`; `;
document.documentElement.appendChild(script); document.documentElement.appendChild(script);
@@ -229,4 +229,4 @@ document.addEventListener('DOMContentLoaded', () => {
})); }));
}); });
console.log('Quality Recticel Print Service: Content script initialized'); console.log('Quality Label Printing Service: Content script initialized');

View File

@@ -1,8 +1,8 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "Quality Recticel Print Service", "name": "Quality Label Printing Service",
"version": "1.0.0", "version": "1.0.0",
"description": "Silent PDF printing service for Quality Recticel application", "description": "Silent PDF printing service for Quality Label Printing application",
"permissions": [ "permissions": [
"activeTab", "activeTab",
@@ -29,7 +29,7 @@
"action": { "action": {
"default_popup": "popup.html", "default_popup": "popup.html",
"default_title": "Quality Recticel Print Service", "default_title": "Quality Label Printing Service",
"default_icon": { "default_icon": {
"16": "icons/icon16.png", "16": "icons/icon16.png",
"32": "icons/icon32.png", "32": "icons/icon32.png",

View File

@@ -160,7 +160,7 @@
<body> <body>
<div class="header"> <div class="header">
<div class="logo">QR</div> <div class="logo">QR</div>
<div class="title">Quality Recticel Print Service</div> <div class="title">Quality Label Printing Service</div>
<div class="version">Version 1.0.0</div> <div class="version">Version 1.0.0</div>
</div> </div>

View File

@@ -1,5 +1,5 @@
/** /**
* Quality Recticel Print Service - Popup Script * Quality Label Printing Service - Popup Script
* Manages the extension popup interface * Manages the extension popup interface
*/ */
@@ -224,7 +224,7 @@ document.addEventListener('DOMContentLoaded', async () => {
*/ */
function showHelp() { function showHelp() {
const helpText = ` const helpText = `
Quality Recticel Print Service Help Quality Label Printing Service Help
================================== ==================================
Installation: Installation:
@@ -244,7 +244,7 @@ Troubleshooting:
• Verify Chrome extension permissions • Verify Chrome extension permissions
• Check service logs: print_service.log • Check service logs: print_service.log
For support, contact the Quality Recticel development team. For support, contact the Quality Label Printing development team.
`; `;
alert(helpText.trim()); alert(helpText.trim());

View File

@@ -1,9 +1,9 @@
@echo off @echo off
REM Quality Recticel Print Service - Windows Native Installation REM Quality Label Printing Service - Windows Native Installation
REM This script creates a lightweight PowerShell-based print service REM This script creates a lightweight PowerShell-based print service
echo ================================================ echo ================================================
echo Quality Recticel Print Service - Native Windows echo Quality Label Printing Service - Native Windows
echo ================================================ echo ================================================
echo. echo.
@@ -20,8 +20,8 @@ echo ✅ Administrator privileges confirmed
echo. echo.
REM Service configuration REM Service configuration
set SERVICE_NAME=QualityRecticelPrintService set SERVICE_NAME=QualityLabelPrinting
set SERVICE_DIR=C:\Program Files\QualityRecticel\PrintService set SERVICE_DIR=C:\Program Files\QualityLabelPrinting\PrintService
echo Creating service directory: %SERVICE_DIR% echo Creating service directory: %SERVICE_DIR%
if not exist "%SERVICE_DIR%" ( if not exist "%SERVICE_DIR%" (
@@ -71,7 +71,7 @@ echo Creating service: %SERVICE_NAME%
echo Binary path: %SERVICE_DIR%\service_wrapper.bat echo Binary path: %SERVICE_DIR%\service_wrapper.bat
echo. echo.
sc create %SERVICE_NAME% binPath="%SERVICE_DIR%\service_wrapper.bat" start=auto DisplayName="Quality Recticel Print Service" sc create %SERVICE_NAME% binPath="%SERVICE_DIR%\service_wrapper.bat" start=auto DisplayName="Quality Label Printing Service"
REM Check if service creation succeeded REM Check if service creation succeeded
sc query %SERVICE_NAME% >nul 2>&1 sc query %SERVICE_NAME% >nul 2>&1
@@ -83,7 +83,7 @@ if errorlevel 1 (
echo ✅ Service created successfully echo ✅ Service created successfully
REM Set description (may fail on older Windows, that's OK) REM Set description (may fail on older Windows, that's OK)
sc description %SERVICE_NAME% "Local HTTP service for silent PDF printing from Quality Recticel web application" >nul 2>&1 sc description %SERVICE_NAME% "Local HTTP service for silent PDF printing from Quality Label Printing web application" >nul 2>&1
goto :service_created goto :service_created

View File

@@ -1,9 +1,9 @@
@echo off @echo off
REM Quality Recticel Print Service - Simple Native Installation REM Quality Label Printing Service - Simple Native Installation
REM This version uses the most basic approach to avoid command line parsing issues REM This version uses the most basic approach to avoid command line parsing issues
echo ================================================ echo ================================================
echo Quality Recticel Print Service - Native Windows echo Quality Label Printing Service - Native Windows
echo ================================================ echo ================================================
echo. echo.
@@ -20,8 +20,8 @@ echo ✅ Administrator privileges confirmed
echo. echo.
REM Service configuration REM Service configuration
set SERVICE_NAME=QualityRecticelPrintService set SERVICE_NAME=QualityLabelPrinting
set SERVICE_DIR=C:\Program Files\QualityRecticel\PrintService set SERVICE_DIR=C:\Program Files\QualityLabelPrinting\PrintService
echo Creating service directory: %SERVICE_DIR% echo Creating service directory: %SERVICE_DIR%
if not exist "%SERVICE_DIR%" ( if not exist "%SERVICE_DIR%" (
@@ -101,7 +101,7 @@ echo ✅ Service created successfully
echo. echo.
echo Configuring service startup... echo Configuring service startup...
sc config "%SERVICE_NAME%" start=auto sc config "%SERVICE_NAME%" start=auto
sc config "%SERVICE_NAME%" DisplayName="Quality Recticel Print Service" sc config "%SERVICE_NAME%" DisplayName="Quality Label Printing Service"
echo. echo.
echo Starting the service... echo Starting the service...

View File

@@ -1,9 +1,9 @@
# Quality Recticel Print Service - PowerShell Implementation # Quality Label Printing Service - PowerShell Implementation
# Native Windows solution with no external dependencies # Native Windows solution with no external dependencies
param( param(
[int]$Port = 8765, [int]$Port = 8765,
[string]$LogFile = "$env:ProgramFiles\QualityRecticel\PrintService\print_service.log" [string]$LogFile = "$env:ProgramFiles\QualityLabelPrinting\PrintService\print_service.log"
) )
# Ensure log directory exists # Ensure log directory exists
@@ -109,10 +109,11 @@ function Send-HttpResponse {
$Context.Response.StatusCode = $StatusCode $Context.Response.StatusCode = $StatusCode
$Context.Response.ContentType = "$ContentType; charset=utf-8" $Context.Response.ContentType = "$ContentType; charset=utf-8"
# Add CORS headers # Add comprehensive CORS headers
$Context.Response.Headers.Add("Access-Control-Allow-Origin", "*") $Context.Response.Headers.Add("Access-Control-Allow-Origin", "*")
$Context.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, OPTIONS") $Context.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PUT, DELETE")
$Context.Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Authorization") $Context.Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept, Origin, X-Requested-With")
$Context.Response.Headers.Add("Access-Control-Max-Age", "86400")
if ($Body) { if ($Body) {
$buffer = [System.Text.Encoding]::UTF8.GetBytes($Body) $buffer = [System.Text.Encoding]::UTF8.GetBytes($Body)
@@ -129,7 +130,7 @@ function Send-HttpResponse {
# Main HTTP server function # Main HTTP server function
function Start-PrintService { function Start-PrintService {
Write-ServiceLog "Starting Quality Recticel Print Service on port $Port" Write-ServiceLog "Starting Quality Label Printing Service on port $Port"
try { try {
# Create HTTP listener # Create HTTP listener
@@ -153,12 +154,19 @@ function Start-PrintService {
Write-ServiceLog "$method $url" Write-ServiceLog "$method $url"
# Handle CORS preflight requests first
if ($method -eq "OPTIONS") {
Write-ServiceLog "Handling CORS preflight request for $url"
Send-HttpResponse -Context $context -StatusCode 200
continue
}
# Handle different endpoints # Handle different endpoints
switch -Regex ($url) { switch -Regex ($url) {
"^/health$" { "^/health$" {
$healthData = @{ $healthData = @{
status = "healthy" status = "healthy"
service = "Quality Recticel Print Service" service = "Quality Label Printing Service"
version = "1.0" version = "1.0"
timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
platform = "Windows PowerShell" platform = "Windows PowerShell"
@@ -207,11 +215,6 @@ function Start-PrintService {
} }
} }
"^/options$" {
# Handle CORS preflight
Send-HttpResponse -Context $context -StatusCode 200
}
default { default {
$errorResponse = @{ $errorResponse = @{
success = $false success = $false
@@ -250,7 +253,7 @@ function Start-PrintService {
} }
# Service entry point # Service entry point
Write-ServiceLog "Quality Recticel Print Service starting..." Write-ServiceLog "Quality Label Printing Service starting..."
# Handle service stop gracefully # Handle service stop gracefully
Register-EngineEvent -SourceIdentifier PowerShell.Exiting -Action { Register-EngineEvent -SourceIdentifier PowerShell.Exiting -Action {

View File

@@ -1,4 +1,4 @@
@echo off @echo off
REM Service wrapper for PowerShell print service REM Service wrapper for PowerShell print service
cd /d "C:\Program Files\QualityRecticel\PrintService" cd /d "C:\Program Files\QualityLabelPrinting\PrintService"
powershell.exe -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -File "print_service.ps1" powershell.exe -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -File "print_service.ps1"

View File

@@ -0,0 +1,79 @@
# Test Windows Print Service CORS and Endpoints
# Run this PowerShell script to test the service
Write-Host "Testing Quality Label Printing Service..." -ForegroundColor Green
Write-Host "=========================================" -ForegroundColor Green
# Test 1: Health check
Write-Host "`n1. Testing Health Endpoint..." -ForegroundColor Yellow
try {
$response = Invoke-RestMethod -Uri "http://localhost:8765/health" -Method GET -TimeoutSec 5
Write-Host "✅ Health check successful:" -ForegroundColor Green
$response | ConvertTo-Json -Depth 3
} catch {
Write-Host "❌ Health check failed: $($_.Exception.Message)" -ForegroundColor Red
}
# Test 2: CORS preflight (OPTIONS request)
Write-Host "`n2. Testing CORS Preflight (OPTIONS)..." -ForegroundColor Yellow
try {
$headers = @{
'Origin' = 'http://localhost:5000'
'Access-Control-Request-Method' = 'POST'
'Access-Control-Request-Headers' = 'Content-Type'
}
$response = Invoke-WebRequest -Uri "http://localhost:8765/print/silent" -Method OPTIONS -Headers $headers -TimeoutSec 5
Write-Host "✅ CORS preflight successful - Status: $($response.StatusCode)" -ForegroundColor Green
# Check CORS headers
$corsHeaders = @('Access-Control-Allow-Origin', 'Access-Control-Allow-Methods', 'Access-Control-Allow-Headers')
foreach ($header in $corsHeaders) {
if ($response.Headers[$header]) {
Write-Host " $header: $($response.Headers[$header])" -ForegroundColor Cyan
} else {
Write-Host " ❌ Missing header: $header" -ForegroundColor Red
}
}
} catch {
Write-Host "❌ CORS preflight failed: $($_.Exception.Message)" -ForegroundColor Red
}
# Test 3: Printers endpoint
Write-Host "`n3. Testing Printers Endpoint..." -ForegroundColor Yellow
try {
$response = Invoke-RestMethod -Uri "http://localhost:8765/printers" -Method GET -TimeoutSec 5
Write-Host "✅ Printers endpoint successful:" -ForegroundColor Green
$response | ConvertTo-Json -Depth 3
} catch {
Write-Host "❌ Printers endpoint failed: $($_.Exception.Message)" -ForegroundColor Red
}
# Test 4: Service status
Write-Host "`n4. Checking Windows Service Status..." -ForegroundColor Yellow
try {
$service = Get-Service -Name "QualityLabelPrinting" -ErrorAction Stop
Write-Host "✅ Service Status: $($service.Status)" -ForegroundColor Green
Write-Host " Service Name: $($service.Name)" -ForegroundColor Cyan
Write-Host " Display Name: $($service.DisplayName)" -ForegroundColor Cyan
} catch {
Write-Host "❌ Service not found or error: $($_.Exception.Message)" -ForegroundColor Red
}
# Test 5: Check service logs
Write-Host "`n5. Recent Service Logs..." -ForegroundColor Yellow
$logPath = "C:\Program Files\QualityLabelPrinting\PrintService\print_service.log"
if (Test-Path $logPath) {
Write-Host "📋 Last 10 log entries:" -ForegroundColor Cyan
Get-Content $logPath -Tail 10 | ForEach-Object { Write-Host " $_" -ForegroundColor White }
} else {
Write-Host "❌ Log file not found at: $logPath" -ForegroundColor Red
}
Write-Host "`n=========================================" -ForegroundColor Green
Write-Host "Service test completed!" -ForegroundColor Green
Write-Host "`nNext steps:" -ForegroundColor Yellow
Write-Host "1. If any tests failed, restart the service: sc restart QualityLabelPrinting" -ForegroundColor White
Write-Host "2. Check firewall settings if connection refused" -ForegroundColor White
Write-Host "3. Verify no other applications using port 8765" -ForegroundColor White
Write-Host "4. Test in browser: http://localhost:8765/health" -ForegroundColor White

View File

@@ -1,9 +1,9 @@
@echo off @echo off
REM Quality Recticel Print Service - Uninstaller REM Quality Label Printing Service - Uninstaller
REM This script removes the Windows print service REM This script removes the Windows print service
echo ================================================ echo ================================================
echo Quality Recticel Print Service - Uninstaller echo Quality Label Printing Service - Uninstaller
echo ================================================ echo ================================================
echo. echo.
@@ -20,8 +20,8 @@ echo ✅ Administrator privileges confirmed
echo. echo.
REM Service configuration REM Service configuration
set SERVICE_NAME=QualityRecticelPrintService set SERVICE_NAME=QualityLabelPrinting
set SERVICE_DIR=C:\Program Files\QualityRecticel\PrintService set SERVICE_DIR=C:\Program Files\QualityLabelPrinting\PrintService
echo Stopping the service... echo Stopping the service...
sc stop "%SERVICE_NAME%" >nul 2>&1 sc stop "%SERVICE_NAME%" >nul 2>&1
@@ -60,10 +60,10 @@ echo ================================================
echo Uninstallation Complete! echo Uninstallation Complete!
echo ================================================ echo ================================================
echo. echo.
echo The Quality Recticel Print Service has been removed from your system. echo The Quality Label Printing Service has been removed from your system.
echo. echo.
echo If you had any Chrome extensions installed, you may want to: echo If you had any Chrome extensions installed, you may want to:
echo 1. Remove the Quality Recticel Print extension from Chrome echo 1. Remove the Quality Label Printing extension from Chrome
echo 2. Clear any remaining Chrome extension data echo 2. Clear any remaining Chrome extension data
echo. echo.
pause pause